Deleting Items
Deleting selected items.
Example Three provides a button for deleting a selected item. This works great: if an item is selected, you can delete it. However, we're currently preventing you from deleting items that have children beneath them. (We do this by testing the open items global variable, not by testing for related records directly, so what we're looking for is, "did the item have children when the hierarchy was last drawn?")
Note that you can use FileMaker's access privileges to prevent deletions in this and other circumstances in addition to what we've done in the hierarchy.
If you want to allow the deletion of records which have children, you'll need to make a couple changes:
1. Make sure the the "data" relationships in the hierarchy have "Delete related records in this table..." checked on the right side of each relationship: for example, in the one between HierarchyDataLevel1 and HierarchyDataLevel2:
2. Edit the script "Delete Selected Item" and find the comment "If Item has children don't delete." Delete this comment, the next one, and the 5 lines below them including the If() statement and everything between it and End If.
That's it.