SeedCodeHierarchy

New Item

SeedCodeHierarchy.NewItem History

Hide minor edits - Show changes to output

Changed lines 3-5 from:
The script "Create New Item" will create new records in your data tables in the following conditions:

to:
The script "Create New Item" will create new records in your data tables in the following circumstances:

Changed lines 8-11 from:
* When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

* When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
to:
* When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be a problem in your file as you'll like be showing all records.

* Similarly, when the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records.
Changed lines 18-19 from:
* Make sure you have the key fields for each table on your "Level..." layouts as described in the integration notes in [[integration | step 9]].
to:
* Make sure you have the key fields for each table on your "HierarchyLevel..." layouts as described in the integration notes in [[integration | step 9]].
Changed lines 22-23 from:
* Make sure the your logged in users have the rights to create records in your data tables.
to:
* Make sure the your logged in users have the rights to create and edit records in your data tables.
Changed lines 28-29 from:
Of course you may need to add more information to a record than simply creating it and linking it to its parent. If you do, edit the script "Create New Item" and find the comment beginning "Set other values as needed...". Add any set field steps you may need immediately following that comment. Remember that we use the same script here regardless of what kind of record we're creating, so you'll likely need to test for the record type first before you set any record specific fields. You can use a test like this:
to:
Of course you may need to add more information to a new record than simply creating it and linking it to its parent. If you do, edit the script "Create New Item" and find the comment beginning "Set other values as needed...". Add any set field steps you may need immediately following that comment. Remember that we use the same script here regardless of what kind of record we're creating, so you'll likely need to test for the record type first before you set any record specific fields. You can use a test like this:
Changed lines 32-33 from:
That would return true if we're on data level 1, making a company record, etc.
to:
That would return true if we're on data level 1, making a company record, etc. Testing for levels in this way would let you add information specific to any level of the hierarchy.
Added lines 34-35:
(:include DeletingItems:)
Deleted lines 33-47:
!! 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.
Changed lines 42-43 from:
''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:
to:
'''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:
Added lines 46-48:
'''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.
Changed lines 44-45 from:
%center% %width=200% http://www.seedcode.com/rootimages/stikipad/hierarchy/cascadedelete.png
to:
%center% %width=500% http://www.seedcode.com/rootimages/stikipad/hierarchy/cascadedelete.png
Changed lines 44-45 from:
to:
%center% %width=200% http://www.seedcode.com/rootimages/stikipad/hierarchy/cascadedelete.png
Changed lines 36-44 from:
< notes forthcoming >
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?")

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:

Added lines 12-13:
Note that creating new top-level records is faster when there is no formatting applied (when neither Outline or Legal formatting is applied). When such formatting ''is'' applied, we need to refresh the whole hierarchy when we create a new item.
Changed line 34 from:
asgs
to:
< notes forthcoming >
Changed lines 16-17 from:
* Make sure you have the key fields for each table on your "Level..." layouts as described in [[integration | step 9]].
to:
* Make sure you have the key fields for each table on your "Level..." layouts as described in the integration notes in [[integration | step 9]].
Added lines 20-21:
* Make sure the your logged in users have the rights to create records in your data tables.
Added lines 12-19:
!! Requirements.

In order to create new items from the hierarchy using our "new item" button, make sure you've taken these steps when [[integration | integrating]] the hierarchy with your own file:

* Make sure you have the key fields for each table on your "Level..." layouts as described in [[integration | step 9]].

* Be sure at least one of your fields on each tab of Example Three has the object name "Level...FirstField" where "..." is the level of the tab you're on. This is described in the notes on [[using example three | integrating Example Three]].

Changed lines 6-11 from:
# * When an item is selected, clicking "new item" will make a child of the selected record.

# * When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

# * When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
to:
* When an item is selected, clicking "new item" will make a child of the selected record.

* When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

* When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
Changed lines 5-10 from:
* When an item is selected, clicking "new item" will make a child of the selected record.

* When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

* When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
to:

# * When an item is selected, clicking "new item" will make a child of the selected record.

# * When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

# * When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
Changed lines 5-10 from:
--> When an item is selected, clicking "new item" will make a child of the selected record.

--> When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

--> When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
to:
* When an item is selected, clicking "new item" will make a child of the selected record.

* When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

* When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected.
Changed lines 5-6 from:
--> When an item is selected, we make a child of the selected record.
to:
--> When an item is selected, clicking "new item" will make a child of the selected record.

--> When no item is selected we attempt to make a new top-level record. But we can only do this if the hierarchy is showing all top-level records. So when Example One is set to 15 or 300 we can't make new-top-level records. This won't be  a problem in your file as you'll like be showing all records.

--> When the hierarchy is filtered as in Example Two we can make a child of a selected record but can not make new top-level records if there is no record selected
.
Changed lines 3-4 from:

to:
The script "Create New Item" will create new records in your data tables in the following conditions:

--> When an item is selected, we make a child of the selected record.

Changed lines 11-14 from:
-> Patterncount ( Get ( LayoutTableName ) ; "Company" )

That would return true if we're making a company record, etc.
to:
-> Patterncount ( Get ( LayoutTableName ) ; "1" )

That would return true if we're on data level 1, making a company record, etc.
Changed lines 11-12 from:
-> Pattercount ( Get ( LayoutTableName ) ; "Company" )
to:
-> Patterncount ( Get ( LayoutTableName ) ; "Company" )
Added lines 1-17:
!! How does the "new item" button work?



!! Adding more info to newly created items.

The hierarchy is written in such a way that it can create new related records in your data tables. This is done in the script "Create New Item" and is written very generically, so it doesn't need to be edited in order to work with your tables.

Of course you may need to add more information to a record than simply creating it and linking it to its parent. If you do, edit the script "Create New Item" and find the comment beginning "Set other values as needed...". Add any set field steps you may need immediately following that comment. Remember that we use the same script here regardless of what kind of record we're creating, so you'll likely need to test for the record type first before you set any record specific fields. You can use a test like this:

-> Pattercount ( Get ( LayoutTableName ) ; "Company" )

That would return true if we're making a company record, etc.

!! Deleting selected items.

asgs
(855) SEEDCODE
[email protected]
Follow us: