Multiple table update on Datawindow
Updates on Data window can be applied using two overloads:
- dwcontrol.Update()
- dwcontrol.Update ( { boolean accept {, boolean resetflag } } )
the 2nd overload has two parameters:
- Accept will perform acceptext() before updation. if validation fails on acceptext(), Update fails.this is by default true on 1st overload of upload.
- resetflag will set the flag that the fields are updated & reflected to Db. By default, it is set to true on 1st overload.
Code Implementation
// this will update the table1 set to update on datawindow & set resetflag to false. dw_datawindow.update(true,false);
// disable table update to previous columns of table 1
dw_datawindow.Modify("column1.Update = No")
dw_datawindow.Modify("column2.Update = No")
dw_datawindow.Modify("column3.Key = No")
// update table changed to this new table 2 & columns
dw_datawindow.Modify("DataWindow.Table.update = ~"db_name..table_2~"")
dw_datawindow.Modify("column_1fortable2.Update = Yes")
dw_datawindow.Modify( "column_2fortable2.Update = Yes")
dw_datawindow.Modify("column_3fortable2.Update = Yes")
dw_datawindow.Modify("column_4fortable2.Update = Yes")
dw_datawindow.Modify("column_5fortable2.Update = Yes")
dw_datawindow.Modify("column_6fortable2.Key = Yes")
dw_datawindow.Update();
// setting back the table1 as updatable table
dw_datawindow.Modify("DataWindow.Table.update = ~"db_name..table_1~"")
dw_datawindow.Modify("column1.Update = Yes")
dw_datawindow.Modify("column2.Update = Yes")
dw_datawindow.Modify("column3.Key = Yes")
// disable table update to previous columns
dw_datawindow.Modify("column_1fortable2.Update = no")
dw_datawindow.Modify( "column_2fortable2.Update = no")
dw_datawindow.Modify("column_3fortable2.Update = no")
dw_datawindow.Modify("column_4fortable2.Update = no")
dw_datawindow.Modify("column_5fortable2.Update = no")
dw_datawindow.Modify("column_6fortable2.Key = no")