Skip to main content
Solved

Need a favor in my custom view


Forum|alt.badge.img

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;

 

Best answer by Naveen Boga

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;

 

View original
Did this topic help you find an answer to your question?

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3412 replies
  • Answer
  • June 27, 2023

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;

 


Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+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;

 


Forum|alt.badge.img

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.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3412 replies
  • June 27, 2023

@oshadarodrigo64  Awesome :) Thanks for sharing the update.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings