Question

Loading data into a graph

  • 25 March 2024
  • 1 reply
  • 40 views

Userlevel 4
Badge +1

Is it possible to make Acumatica load all data into a graph? In the code below I create a SOOrderEntry graph, find an existing sales order and set the current document to the sales order.

This sets the current document but it doesn’t load the sales order lines - as it would if I was using the UI. 
The value of sOOrderEntry.Transactions.Current is null. 

In the final 2 lines I set the  Transactions.Current value myself by selecting the first record returned from Select, but is there a way to make Acumatica load data into the SOLine view (and other views) automatically? (like the UI does)

public PXAction<INKitRegister> UpdateSalesOrder;
[PXUIField(DisplayName = "Update Sales Order")]
protected virtual IEnumerable updateSalesOrder(PXAdapter adapter)
{
SOOrderEntry sOOrderEntry = PXGraph.CreateInstance<SOOrderEntry>();
SOOrder sOOrder = sOOrderEntry.Select<SOOrder>().FirstOrDefault(x => x.OrderNbr == "SO000276");
sOOrderEntry.Document.Current = sOOrder;
SOLine sOLine = sOOrderEntry.Transactions.Current;

sOOrderEntry.Transactions.Current = sOOrderEntry.Transactions.Select().First();
sOLine = sOOrderEntry.Transactions.Current;
}

 


1 reply

Badge +11

This is an assumption, but I believe much of the UI only loads data when it is requested. I believe this is what the LoadOnDemand property is on Tab Item. The difference would be that it is seamless in the UI and you never notice it happening.

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