Skip to main content
Solved

How to work with Bql for a drop down value


Forum|alt.badge.img

Any idea to write below SQL query in BQL or in Fbql?
 

SELECT * FROM SOOrder 
where  Status ='N' & 'H'

 

Best answer by Naveen Boga

@rashmikamudalinayake10  Here is the BQL Query.

 

If you are using this query in graph extension:

 SOOrder objSOOrder = PXSelect<SOOrder, Where<SOOrder.status, Equal<SOOrderStatus.hold>, And<SOOrder.status, Equal<SOOrderStatus.open>>>>.Select(Base);

 

For your custom graph β†’ Base will not work, you can use this like below.

 

 SOOrder objSOOrder = PXSelect<SOOrder, Where<SOOrder.status, Equal<SOOrderStatus.hold>, And<SOOrder.status, Equal<SOOrderStatus.open>>>>.Select(this);

 

View original
Did this topic help you find an answer to your question?

7 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3409 replies
  • Answer
  • October 20, 2023

@rashmikamudalinayake10  Here is the BQL Query.

 

If you are using this query in graph extension:

 SOOrder objSOOrder = PXSelect<SOOrder, Where<SOOrder.status, Equal<SOOrderStatus.hold>, And<SOOrder.status, Equal<SOOrderStatus.open>>>>.Select(Base);

 

For your custom graph β†’ Base will not work, you can use this like below.

 

 SOOrder objSOOrder = PXSelect<SOOrder, Where<SOOrder.status, Equal<SOOrderStatus.hold>, And<SOOrder.status, Equal<SOOrderStatus.open>>>>.Select(this);

 


Forum|alt.badge.img

Thanks!! it worked.

Also, I just tried the same thing by implementing to a PXSelector. Below is the code .but it doesn’t work. btw it worked on getting single value. Something wrong with the query?

[PXSelector
            (typeof(Search<SOOrder.orderNbr,
                    Where<SOOrder.status,
                    Equal<SOOrderStatus.open>,
                    And<SOOrder.status,
                    Equal<SOOrderStatus.hold>>>>))]

This works fine,

[PXSelector
            (typeof(Search<SOOrder.status,
                    Where<SOOrder.status,
                    Equal<SOOrderStatus.open>>>))]

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3409 replies
  • October 20, 2023

@rashmikamudalinayake10  Great, Thanks for sharing the update!!


vardan22
Jr Varsity III
Forum|alt.badge.img+1
  • Jr Varsity III
  • 44 replies
  • October 20, 2023

In your PXSelector attribute you need to update And<> condition with Or<> to be able to get the more than one record. But my suggestion bellow

 [PXSelector(typeof(Search<SOOrder.orderNbr,Where<SOOrder.status,In3<SOOrderStatus.open, SOOrderStatus.hold>>>))]

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3409 replies
  • October 20, 2023

Yes @rashmikamudalinayake10  Please change the Condition to OR instead of AND.

Due to this AND condition system not fetching any records.


Forum|alt.badge.img

Thanks!! it worked.


Forum|alt.badge.img

Correct query for fetching open state and hold state using PXSelector as below

[PXSelector
            (typeof(Search<SOOrder.orderNbr,
                    Where<SOOrder.status,
                    Equal<SOOrderStatus.open>,
                    Or<SOOrder.status,
                    Equal<SOOrderStatus.hold>>>>))]

Note: The above mentioned snippet by vardan22 also work as well.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings