Solved

Need a favor in my custom view

  • 27 June 2023
  • 4 replies
  • 42 views

Userlevel 3
Badge

Hi,

I have to add another two more conditions to my custom view.

*get sales orders when InventoryItem.itemType == charges or soline.openQty > 0

The sql query is something like this to get an idea,

Select * from 
soline line
innerJoin soorder order on line.orderNbr/ordertype= order.orderNbr/ordertype
leftJoin solinesplit split on line.orderNbr/orderType/lineNbr = split.orderNbr/orderType/lineNbr

leftJoin inventoryItem item on line.inventoryId= item.inventoryId

where other conditions....
and order.status != "Cancelled"
and (item.itemType == "Charges" or line.openQty > 0)

 I tried to apply above condition in the below bql query but it doesn’t look like as what I wanted. so could someone please to help me on this?

public PXSelectJoin<
SOLine, InnerJoin<SOOrder, On<SOLine.orderNbr, Equal<SOOrder.orderNbr>,
And<SOLine.orderType, Equal<SOOrder.orderType>>
>, LeftJoin<SOLineSplit, On<SOLine.orderNbr, Equal<SOLineSplit.orderNbr>,
And<SOLine.orderType, Equal<SOLineSplit.orderType>,
And<SOLine.lineNbr, Equal<SOLineSplit.lineNbr>>>
>, LeftJoin<InventoryItem, On<SOLine.inventoryID, Equal<InventoryItem.inventoryID>>>>>,
Where<SOLine.customerID, Equal<Current<APProforma.customerID>>,
And<
SOOrder.customerLocationID, Equal<Current<APProforma.locationCD>>,
And<SOOrder.status, NotEqual<SOOrderStatus.cancelled>,
And<InventoryItem.itemType, Equal<INItemTypes.chargeItem>,
Or<SOLine.openQty, Greater<decimal0>>>>
>>> POrdersView;

 

icon

Best answer by Naveen Boga 27 June 2023, 15:03

View original

4 replies

Userlevel 7
Badge +17

Hi @oshadarodrigo64  Please check with the below view

 


public PXSelectJoin<
SOLine, InnerJoin<SOOrder, On<SOLine.orderNbr, Equal<SOOrder.orderNbr>,
And<SOLine.orderType, Equal<SOOrder.orderType>>
>, LeftJoin<SOLineSplit, On<SOLine.orderNbr, Equal<SOLineSplit.orderNbr>,
And<SOLine.orderType, Equal<SOLineSplit.orderType>,
And<SOLine.lineNbr, Equal<SOLineSplit.lineNbr>>>
>, LeftJoin<InventoryItem, On<SOLine.inventoryID, Equal<InventoryItem.inventoryID>>>>>,
Where<SOLine.customerID, Equal<Current<APProforma.customerID>>,
And<
SOOrder.customerLocationID, Equal<Current<APProforma.locationCD>>,
And<SOOrder.status, NotEqual<SOOrderStatus.cancelled>,
And<Where<InventoryItem.itemType, Equal<INItemTypes.chargeItem>,
Or<SOLine.openQty, Greater<decimal0>>>>>
>>> POrdersView;

 

Userlevel 6
Badge +3

If you use FBQL, you can use brackets:

 

        public SelectFrom<SOLine>
.InnerJoin<SOOrder>.On<SOLine.orderNbr.IsEqual<SOOrder.orderNbr>.And<
SOLine.orderType.IsEqual<SOOrder.orderType>>>
.LeftJoin<SOLineSplit>.On<SOLine.orderNbr.IsEqual<SOLineSplit.orderNbr>
.And<SOLine.orderType.IsEqual<SOLineSplit.orderType>
.And<SOLine.lineNbr.IsEqual<SOLineSplit.lineNbr>>>>
.LeftJoin<InventoryItem>.On<SOLine.inventoryID.IsEqual<InventoryItem.inventoryID>>
.Where<SOLine.customerID.IsEqual<APProforma.customerID.FromCurrent>
.And<SOOrder.customerLocationID.IsEqual<APProforma.locationCD.FromCurrent>>
.And<SOOrder.status.IsNotEqual<SOOrderStatus.cancelled>>
.And<Brackets<InventoryItem.itemType.IsEqual<INItemTypes.chargeItem>
.Or<SOLine.openQty.IsGreater<decimal0>>>>>
.View POrdersView;

 

Userlevel 3
Badge

Hi @Naveen Boga 

Genius! your solution worked. Thank you very much. And also @zfebert56 thanks for you as well for sharing what you know on this.

Userlevel 7
Badge +17

@oshadarodrigo64  Awesome :) Thanks for sharing the update.

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