How Do I Implement a One-to-Many Relationship in Magic xpa When There is a Database Constraint? (Magic xpa 2.x)
Often you will have a form where the parent task displays and updates one record, while a subtask displays and updates child records. In this case, the parent record might not actually be written to the database table when the child task takes control.
To avoid this, you want to commit the parent record before the child task takes control. You can do this easily in Magic xpa by doing the following:
-
Set the Parent transaction mode to Deferred or Within Active (where the task that opens the transaction is Deferred).
-
Set the Child task transaction mode to either Deferred or Within Active.
-
On the Call operation, set the Sync Data property to Yes.
If you are using a Subform rather than a Call operation, you don’t have Sync Data property available to set. However, if the parent and child tasks are set as explained above, the Subform task is automatically called as if the Sync Data property were set to Yes.
The Online and Rich Client Samples projects (program SQ03 and RSQ03)