SeedCodeHierarchy

Deleting Items

SeedCodeHierarchy.DeletingItems History

Hide minor edits - Show changes to output

Changed lines 7-8 from:
If you want to allow the deletion of records which have children, you'll need to make a couple changes:
to:
If you want to ''allow'' the deletion of records which have children, you'll need to make a couple changes:
Changed lines 3-4 from:
[[ UsingExampleThree | 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 drawn?")
to:
[[ UsingExampleThree | 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?")
Changed lines 3-4 from:
[[ UsingExampleThree | 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 drawn?")
to:
[[ UsingExampleThree | 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 drawn?")
Added lines 1-15:
!! Deleting selected items.

[[ UsingExampleThree | 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 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:

%center% %width=500% http://www.seedcode.com/rootimages/stikipad/hierarchy/cascadedelete.png

'''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.
(855) SEEDCODE
[email protected]
Follow us: