Solved

Need help with a BQL command (PXFilteredProcessingJoinOrderBy)

  • 11 July 2023
  • 2 replies
  • 75 views

Userlevel 6
Badge +3

On my processing page, I have a filter to select based on an inventory item.

It is working and selecting rows for my grid using this BQL

		public PXFilteredProcessingJoin<SOLine, RecordsToProcessFilter, InnerJoin<SOOrder, On<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>,
Where<SOLine.inventoryID, Equal<RecordsToProcessFilter.inventoryID.FromCurrent>,
And<SOLine.completed, Equal<False>,
And<SOLine.openQty, Greater<decimal0>,
And<SOOrder.status, Equal<SOOrderStatus.open>>>>>> SOLinesToUpdate;

I want to add OrderBy so that the lines are displayed in order by Sales Order Nbr, Line Nbr.

This is the BQL I cannot get to compile

		public PXFilteredProcessingJoinOrderBy<SOLine, RecordsToProcessFilter, InnerJoin<SOOrder, On<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>,
Where<SOLine.inventoryID, Equal<RecordsToProcessFilter.inventoryID.FromCurrent>,
And<SOLine.completed, Equal<False>,
And<SOLine.openQty, Greater<decimal0>,
And<SOOrder.status, Equal<SOOrderStatus.open>>>>>,
OrderBy<Asc<SOLine.orderNbr, Asc<SOLine.lineNbr>>>> SOLinesToUpdate;

This is the error message

It looks like all my < and > are accounted for.  

If I get rid of the Where section, it compiles, but it returns all rows.  I need the Where to restrict the result set in the grid.

This one compiles and works but returns all rows (as in EVERY ROW in the SOLine table)

		public PXFilteredProcessingJoinOrderBy<SOLine, RecordsToProcessFilter,
InnerJoin<SOOrder, On<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>,
OrderBy<Asc<SOLine.orderNbr, Asc<SOLine.lineNbr>>>> SOLinesToUpdate;

 

Any ideas how I can add my Where into this so that it compiles?

 

icon

Best answer by Naveen Boga 11 July 2023, 05:57

View original

2 replies

Userlevel 7
Badge +17

Hi @Joe Schmucker 

I have made several modifications to your code. Please review the details provided below:

  1. In the Join, I included the Order Type field. It is strongly advised to use this field as it serves as a KEY field.

  2. Please note that the WHERE Clause does not support PXFilteredProcessingJoinOrderBy. Therefore, it is advisable not to include it in your code.

  3. To address the issue mentioned above, I have created a view delegate for the view SOLinesToUpdate. In this delegate, I added a Where Clause along with an Order By clause. I am optimistic that this modification will resolve the problem you encountered.

Please incorporate these changes into your code and test it accordingly.

 

Here is the code:

 

 public PXFilter<RecordsToProcessFilter> Filter;
[PXFilterable]
public PXFilteredProcessingJoinOrderBy<SOLine, RecordsToProcessFilter, InnerJoin<SOOrder, On<SOOrder.orderType,Equal<SOLine.orderType>,And<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>>,
//Where<SOLine.inventoryID, Equal<Current<ICSPricingINItemClass.priceClassID>>,
//And<SOLine.completed, Equal<False>,
//And<SOLine.openQty, Greater<decimal0>,
//And<SOOrder.status, Equal<SOOrderStatus.open>>>>>,
OrderBy<Asc<SOLine.orderNbr, Asc<SOLine.lineNbr>>>> SOLinesToUpdate;

protected virtual IEnumerable sOLinesToUpdate()
{
RecordsToProcessFilter filter = Filter.Current;
if (filter != null)
{
PXSelectBase<SOLine> preparedorder = new PXSelectJoin<SOLine, InnerJoin<SOOrder, On<SOOrder.orderType, Equal<SOLine.orderType>, And<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>>,
Where<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>,
And<SOLine.completed, Equal<False>,
And<SOLine.openQty, Greater<decimal0>,
And<SOOrder.status, Equal<SOOrderStatus.open>>>>>,
OrderBy<Asc<SOLine.orderNbr,Asc<SOLine.lineNbr>>>>(Base);

return preparedorder.Select(filter.InventoryID);
}
return null;
}

 

Userlevel 6
Badge +3

@Naveen Boga Thanks Naveen.  This is awesome. 

Just a follow up question about the code you provided.  I am creating a Process screen that will allow me to “change” the action for the process.  I am looking at the Process Orders screen SO501000 (graph is SOCreateShipment).  I’m digesting how that graph works.  They do something similar to what you are doing here with the view delegate.  Is this the “trick” to being able to change the “select statement” for a View that has filters?  I am thinking this is exactly what you are doing here.  If so, that goes a long way to explain this methodology for changing a View result set on a Processing screen where there is a filter.  I think what I would do is use the delegate to “switch” the view based on the selected action in the drop down list of available actions for the processing screen.

THANKS AGAIN.

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