Skip to main content

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

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

 

@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);

 


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>>>))]

 


@rashmikamudalinayake10  Great, Thanks for sharing the update!!


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>>>))]

 


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

Due to this AND condition system not fetching any records.


Thanks!! it worked.


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

qPXSelector
(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