What is the best way to delete detail records when deleting a master record.
Say i have a master table offices and a detail table departments. Now i want to delete a master office (and the detail departments). But i want to be able to undo the delete action with api_datasource.executequery, so i need to only remove the records from the office and department datasources.
Deleting the master is not the problem, api_datasource.deleteCurrentRow will do that, but how about the detail department records? What will be the best way to do that? Can you give an example?
asked 27 Jun '12, 05:00
In Formspider version 1.1 and later: (The development version we sent you includes this feature)
In the action code of the delete button, delete the detail rows before deleting the master row. Then, Formspider commits changes in the order they have occurred.
In Formspider version 1.0 and earlier:
Use the datasource commit order property. Assign a smaller order number to the master datasource, so that the changes to the master rows are applied first during the commit operation. This works fine for the insert operation. However, for the delete operation, Formspider tries to delete master rows before the detail rows. To prevent the integrity constraint error, delete the details in the "Before Delete" trigger of the master table. Please note that you may consider unchecking the Delete Allowed checkbox property of the detail Datasource Definition at this point because when Formspider issues changes for this datasource during a commit, the rows will be already deleted.
answered 27 Jun '12, 08:02
Ugur Kocak ♦
You can delete all the details with ALL_ROWS option:
answered 27 Jun '12, 05:44
Ugur Kocak ♦