Solved

How to work with Bql for a drop down value

  • 19 October 2023
  • 7 replies
  • 69 views

Userlevel 3
Badge

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

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

 

icon

Best answer by Naveen Boga 20 October 2023, 05:55

View original

7 replies

Userlevel 7
Badge +17

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

 

Userlevel 3
Badge

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

 

Userlevel 7
Badge +17

@rashmikamudalinayake10  Great, Thanks for sharing the update!!

Userlevel 4
Badge +1

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

 

Userlevel 7
Badge +17

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

Due to this AND condition system not fetching any records.

Userlevel 3
Badge

Thanks!! it worked.

Userlevel 3
Badge

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


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved