Solved

Save records to a different table.

  • 10 January 2024
  • 2 replies
  • 48 views

Userlevel 3
Badge

Hi Team,

I need to save some data into an another table in the DB. I created a table in the DB and also created a DAC. 

Can someone please help me?

public PXSelect<CISTaxSubmittedData> cisTaxSubmittedData;

[PXButton(CommitChanges = true)]
        [PXUIField(DisplayName = "Submit Tax Report", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = false)]
        protected virtual IEnumerable submitTaxReport(PXAdapter adapter)
        {

             need to save data to the cisTaxSubmittedData

             return adapter.Get();

        }

 

icon

Best answer by Django 11 January 2024, 00:23

View original

2 replies

Userlevel 7
Badge +5

In that line of code you’re going to create an instance of the graph used to manage those records.

Something like:

YourGraph graph = PXGraph.CreateInstance<YourGraph>();
YourDAC record = (YourDAC)graph.graphView.Insert(new YourDAC());
record.field = somevalue;
record.field2 = somevalue;
record = (YourDAC)graph.graphView.Cache.Update(record);
graph.Save.Press();

If you’re planning to update an existing record then instead of the .Insert line, you’ll locate the record you want to update and then set the new field values, call .Update and then save.

Userlevel 3
Badge

In that line of code you’re going to create an instance of the graph used to manage those records.

Something like:

YourGraph graph = PXGraph.CreateInstance<YourGraph>();
YourDAC record = (YourDAC)graph.graphView.Insert(new YourDAC());
record.field = somevalue;
record.field2 = somevalue;
record = (YourDAC)graph.graphView.Cache.Update(record);
graph.Save.Press();

If you’re planning to update an existing record then instead of the .Insert line, you’ll locate the record you want to update and then set the new field values, call .Update and then save.

Thank you very much @Django 

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