Skip to main content
Answer

Unable to save data to DB While copying screen1 grid values to screen2 grid.

  • March 1, 2023
  • 1 reply
  • 115 views

Forum|alt.badge.img+1

I want to save screen1 grid values to screen2 grid.

I have created a Dataview  in screen2. I’m unable to save records into DB.

 

Sample code:

                               //DataView creation
                                public SelectFrom < TestFSSOLine >.View TestFSSOLineGridView;
                                
                                
                                // copying the lines from screen1 grid to screen2 grid.
                                
                                foreach (TestFSSOTemplateLine line in lines)
                                {
                                    TestFSSOLine templateLine = new TestFSSOLine();
                                    templateLine.LineNbr = line.LineNbr;
                                    templateLine.SMEquipmentID = line.SMEquipmentID;
                                    templateLine.InventoryID = line.InventoryID;
                                    templateLine.Description = line.Description;
                                    templateLine.Qty = line.Qty;
                                   
                                    I have tried the below to save data into DB.
                                    but nothing got worked for me.
                                    
                                    //TestFSSOLineGridView.Cache.Update(templateLine);
                                    //TestFSSOLineGridView.Update(templateLine);
                                    //TestFSSOLineGridView.Cache.Insert(templateLine);
                                    //TestFSSOLineGridView.View.AllowInsert = true;
                                    //TestFSSOLineGridView.Cache.Update(templateLine);
                                    //TestFSSOLineGridView.Insert(templateLine);
                                    //TestFSSOLineGridView.Cache.Persisted(true);
                                }

 

Note: I have tried with cache clear also before updating the DataView

like: TestFSSOLineGridView.Cache.Clear();

      TestFSSOLineGridView.Cache.ClearQueryCache();

     TestFSSOLineGridView.Cache.ClearQueryCacheObsolete();

 

Could you please help me on this?

 

Thanks in Advance.

Shahidavali Syed..

 

Best answer by aaghaei

When you insert data into cache, you need to save. If your code is running in a graph ext then using Base.Save.Press(); you will commit and save the changes to DB. 
 

my assumption is your DAC and its key is set up and defined correctly.

1 reply

aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • Answer
  • March 1, 2023

When you insert data into cache, you need to save. If your code is running in a graph ext then using Base.Save.Press(); you will commit and save the changes to DB. 
 

my assumption is your DAC and its key is set up and defined correctly.