Skip to main content
Solved

Is It Possible to bind two views to a single grid?


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 38 replies

Hi, i have Created a form and grid in a popup of action methrod. i have added a selector to the form and when i select a value from selector, grid gets triggered and its working fine, now i want to add another selector and that selector should trigger the same grid,   any help is highly appreciated

Thanks in advance

Best answer by darylbowman

Something like this should get you close:

public SelectFrom<ARInvoice>.
    InnerJoin<ARTran>.
        On<ARTran.tranType.IsEqual<ARInvoice.docType>.
            And<ARTran.refNbr.IsEqual<ARInvoice.refNbr>>>.
    InnerJoin<InventoryItem>.
        On<InventoryItem.inventoryID.IsEqual<ARTran.inventoryID>>.
    InnerJoin<INItemXRef>.
        On<INItemXRef.inventoryID.IsEqual<InventoryItem.inventoryID>>.
    Where<ARInvoice.customerID.IsEqual<SOOrder.customerID.FromCurrent>.
        And<InventoryItem.inventoryID.IsEqual<TestInventory.inventoryId.FromCurrent>.
        Or<INItemXRef.alternateID.IsEqual<TestInventory.alterateId.FromCurrent>>>>.View Invview;

Assuming your class TestInventory has a field AlternateId.

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

10 replies

Yuriy Zaletskyy
Jr Varsity I
Forum|alt.badge.img+3

For me it sounds, like you want to have two selectors for two different columns in the grid. If that is the case, then yes, you may have two selectors for two different columns. As an example you can look for plenty of forms of Acumatica, when one column selector has dependency from what is selected in another selector. For example Projects and project tasks forms.


darylbowman
Captain II
Forum|alt.badge.img+13

Some additional information would be helpful. What does selecting a value with selectors do to the grid? Filter it? Fill it with data?


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 15, 2023

Firstly i have created a action with a popup in Sales order screen. And i have added a selector for inventory, and we i select a record in inventory selector then it displays all the invoice items for that paticular inventory and paticular customer in the grid of sales order screen.  now i need to add another selector besides inventory selector to filter data by Alternate id for stock items,  i want to use the same grid to work for both the selectors,  is that possible?

 


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 15, 2023

@Yuriy Zaletskyy  No, i want to all the feilds on same grid, for eaither of the two selectors

 


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 15, 2023

@darylbowman , I have Created a popup with inventory id selector. when i select it, it pulls all the invoice for that paticular inventory and customer of the current Sales order screen. now i want to append the funtionality i.e i want to add anothe selector that displays all Alternate ids for the stock item and when i select it it should funtion in the same way that is display all the invoices for that inventory

 


darylbowman
Captain II
Forum|alt.badge.img+13

Yes, this is possible, and by your description will work exactly like the filter fields on many Acumatica screens. You simply need to include the selected values in the conditions of the data view you have bound to the grid.

If you want them to work independently (one at a time), you should write code to erase one when the other is updated.

If they can work together (both at once), then build that into your logic.


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 15, 2023

@darylbowman , So You mean to say If we change the Condtion of Grid View then we can Acheive it?, Hear is my code, can you please look at it once and guide me

 public PXAction<SOOrder> InvFilter;
        [PXUIField(DisplayName = "Invoice Filter", Enabled = true)]
        [PXButton(CommitChanges = true)]
        public virtual IEnumerable invFilter(PXAdapter adapter)
        {

            var q = Invview.Select().Count;

            var k = Invview.AskExt();
            if (this.Invview.AskExt() == WebDialogResult.OK)
            {
                foreach (ARInvoice invoice in Invview.Select())

                {
                    if (invoice.Selected == true)
                    {


                            foreach (ARTran tran1 in PXSelect<ARTran, Where<ARTran.tranType, Equal<Current<ARInvoice.docType>>, And<ARTran.refNbr, Equal<Current<ARInvoice.refNbr>>>>>.Select(Base, invoice.RefNbr, invoice.DocType))
                            {

                             
                                SOLine oLine2 = PXSelect<SOLine, Where<SOLine.orderType, Equal<Required<ARTran.sOOrderType>>, And<SOLine.orderNbr, Equal<Required<ARTran.sOOrderNbr>>, And<SOLine.lineNbr, Equal<Required<ARTran.sOOrderLineNbr>>>>>>.Select(Base, tran1.SOOrderType, tran1.SOOrderNbr, tran1.SOOrderLineNbr);
                                SOLine line1 = PXSelect<SOLine, Where<SOLine.orderType, Equal<Required<SOLine.orderType>>, And<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>, And<SOLine.lineNbr, Equal<Required<SOLine.lineNbr>>>>>>.Select(Base, tran1.SOOrderType, tran1.SOOrderNbr, tran1.SOOrderLineNbr);

                                if (line1 != null)
                                {
                                    SOLine line = new SOLine();
                                    //line.OrderType = tran1.SOOrderType;
                                    //line.OrderNbr = tran1.SOOrderNbr;
                                    line.InventoryID = line1.InventoryID;
                                    //line.UOM = tran1.UOM;
                                    line.BranchID = line1.BranchID;
                                    line.OrderQty = line1.OrderQty;
                                    line.UOM = line1.UOM;
                                    line.InvoiceNbr = invoice.RefNbr;
                                    //line.SiteID = tran1.SiteID;
                                    //line.TranDesc = tran1.TranDesc;
                                    //line.CuryUnitPrice = tran1.CuryUnitPrice;
                                    Base.Transactions.Insert(line);

                                }

                             
                            }
                        

                    }
                }
            }


            return adapter.Get();

 

 

        #region Views

        public PXSelectJoin<ARInvoice, InnerJoin<ARTran, On<ARTran.tranType, Equal<ARInvoice.docType>, And<ARTran.refNbr, Equal<ARInvoice.refNbr>>>>,
    //InnerJoin<SOOrder, On<SOOrder.orderNbr, Equal<ARTran.sOOrderNbr>>>>,
    Where<ARInvoice.customerID, Equal<Current<SOOrder.customerID>>, And<ARTran.inventoryID, Equal<Current<TestInventory.inventoryId>>>>> Invview;
 public PXSelect<TestInventory, Where<TestInventory.inventoryId, Equal<Current<TestInventory.inventoryId>>>> Testinventory;
        public PXSelect<StockAlterId, Where<StockAlterId.alternateID, Equal<Current<StockAlterId.alternateID>>>> AlternateInvId;
        public PXSelectJoin<ARInvoice, InnerJoin<ARTran,On<ARTran.tranType,Equal<ARInvoice.docType>,And<ARTran.refNbr, Equal<ARInvoice.refNbr>>>,InnerJoin<INItemXRef, On<ARTran.inventoryID, Equal<INItemXRef.inventoryID>>>>, Where<ARInvoice.customerID, Equal<Current<SOOrder.customerID>>, And<ARTran.inventoryID, Equal<Current<StockAlterId.alternateID>>>>>InvoiceView;
        #endregion


darylbowman
Captain II
Forum|alt.badge.img+13
  • 1712 replies
  • Answer
  • September 15, 2023

Something like this should get you close:

public SelectFrom<ARInvoice>.
    InnerJoin<ARTran>.
        On<ARTran.tranType.IsEqual<ARInvoice.docType>.
            And<ARTran.refNbr.IsEqual<ARInvoice.refNbr>>>.
    InnerJoin<InventoryItem>.
        On<InventoryItem.inventoryID.IsEqual<ARTran.inventoryID>>.
    InnerJoin<INItemXRef>.
        On<INItemXRef.inventoryID.IsEqual<InventoryItem.inventoryID>>.
    Where<ARInvoice.customerID.IsEqual<SOOrder.customerID.FromCurrent>.
        And<InventoryItem.inventoryID.IsEqual<TestInventory.inventoryId.FromCurrent>.
        Or<INItemXRef.alternateID.IsEqual<TestInventory.alterateId.FromCurrent>>>>.View Invview;

Assuming your class TestInventory has a field AlternateId.


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 15, 2023

Thank you @darylbowman ,it seems like it is Best Answer , i will check it and Respond


Atiq
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 38 replies
  • September 19, 2023

Thank You @darylbowman , It worked for me 


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