Solved

How to craft PXSelect / BQL for two or's and-ed together

  • 17 February 2022
  • 2 replies
  • 448 views

I would like the equivalent of 

 

select * from APIRequests

where (processed == false or processed is null)

and (siteid = current.siteid or current.siteid is null)

 

below is as close as I could get with BQL, but still missing one or statement:

 var cmd = new PXSelect<APIRequests, Where<

 APIRequests.siteID, Equal<Current<APIRequestsFilter.siteID>>,

 And

 <Where<APIRequests.processed, Equal<False>, Or<APIRequests.processed, IsNull>>>

 >, OrderBy<Asc<APIRequests.date>>>(this);

 

icon

Best answer by jinin 17 February 2022, 18:09

View original

2 replies

Userlevel 7
Badge +11

Hi @jkelly80 

Can you try like below?  Please verify and let me know if face any issues.

               var cmd = new PXSelect<APIRequests,
                                              Where2<Where<APIRequests.processed, Equal<False>, Or<APIRequests.processed, Equal<Null>>>,
                                              And<Where<APIRequests.siteID, Equal<Current<APIRequests.siteID>>, Or<APIRequests.siteID, Equal<Null>>>>>,
                                              OrderBy<Asc<APIRequests.date>>>(this);

Userlevel 4
Badge +1

hi @jkelly80 

In continuation to @jinin  code we can also define Is null with out Equal 

var cmd = new PXSelect<APIRequests,
              Where2<Where<APIRequests.siteID, Equal<Current<APIRequestsFilter.siteID>>,
                        Or<APIRequests.siteID, IsNull>>,
                  Or<Where<APIRequests.(processed, Equal<Current<APIRequestsFilter.(processed >>,
                        Or<APIRequests.(processed, IsNull >>>>>(this);

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