1.

How Can You Update Multiple Database Tables From One Datawindow?

Answer»

Using MODIFY() function. When a DataWindow is based on a join of multiple tables, we can update all of those tables by modifying attributes DataWindow.Table, UpdateTable and column attributes Update and KEY using Modify() function. For example, if the data initially came from DEPARTMENT and EMPLOYEE tables, and DEPARTMENT table was specified as an Update Table when we PAINTED the DataWindow, we need to:

1. Update the DEPARTMENT table using the Update() function:

iRet = dw_1.Update (TRUE (AcceptText(), FALSE (ResetBuffer))

2.Modify the Update CHARACTERISTICS of the DataWindow to point to the Employee table:

IF iRet = 1 THEN
dw_1.Modify(“Dep_id.Update = NO”) dw_1.Modify(“Dep_name.Update = NO”)
dw_1.Modify(“Dep_id.Key = NO”)
dw_1.Modify(“DataWindow.Table.Updatetable = ‘employee’”)
dw_1.Modify(“Dep_id.Update = YES”)
dw_1.Modify(“Dep_name.Update = YES”)
dw_1.Modify(“Dep_id.Key = YES”)
dw_1.Update()
END IF

Using Modify() function. When a DataWindow is based on a join of multiple tables, we can update all of those tables by modifying attributes DataWindow.Table, UpdateTable and column attributes Update and Key using Modify() function. For example, if the data initially came from DEPARTMENT and EMPLOYEE tables, and DEPARTMENT table was specified as an Update Table when we painted the DataWindow, we need to:

1. Update the DEPARTMENT table using the Update() function:

iRet = dw_1.Update (TRUE (AcceptText(), FALSE (ResetBuffer))

2.Modify the Update characteristics of the DataWindow to point to the Employee table:

IF iRet = 1 THEN
dw_1.Modify(“Dep_id.Update = NO”) dw_1.Modify(“Dep_name.Update = NO”)
dw_1.Modify(“Dep_id.Key = NO”)
dw_1.Modify(“DataWindow.Table.Updatetable = ‘employee’”)
dw_1.Modify(“Dep_id.Update = YES”)
dw_1.Modify(“Dep_name.Update = YES”)
dw_1.Modify(“Dep_id.Key = YES”)
dw_1.Update()
END IF



Discussion

No Comment Found