Skip to main content
Solved

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

  • 1 March 2023
  • 1 reply
  • 102 views

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..

 

1 reply

Userlevel 7
Badge +9

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.

Reply