SeedCodeHierarchy

Selecting An Item

How can I use a selected item?

When you click anywhere in an item's row, the hierarchy selects the item and highlights its row green. (You can change this color by editing the conditional formatting applied to the z_BlankGlob field which acts as the row background.)

Once selected, the ID of the selected item is stored for you to use in your own scripts. It is stored in the field Hierarchy::SeletedItemIDGlob and in the global variable $$Hy_SelectedItemID. If you may have similar IDs in your different tables, you can also determine which table (which level) the selected item belongs to: this is stored in the global variable $$Hy_SelectedItemLevel.

And all of this comes together in our script "Go to Item" which you can use as the basis for your own scripts that go to, show, or manipulate selected items.

Be sure to check out Example Three where we show the selected item's details to the right of the hierarchy layout.

Can I reveal a given item in the hierarchy?

Yes. If you're on a record in one of your layouts and would like to see that record revealed in the hierarchy simply call the script "Reveal Item in Hierarchy ( ID )" while sending the unique ID of the record you're interested in as the script parameter. This script will open the hierarchy as needed to reveal your record. If the top-level parent of your record is not visible, we'll ask if you'd like to show all top level records before revealing your item.

You can use this script to have the hierarchy "keep up" with you while you navigate through your records. And you can call this script using the zippScript plugin if you want the current record to be displayed in the hierarchy while you scroll through records. See the documentation that comes with zippScript for more on how to trigger scripts when you arrive at a new record.

Note that this "Reveal Item in Hierarchy ( ID )" script attempts to switch layouts and end on the Hierarchy layout in our example. If you're showing the hierarchy on another layout in your file you may wish to edit this script or remove this part. To do so, find the comment beginning "If you might be calling this from somewhere else..." and edit or remove the next three lines.

Note that revealing items in this way does not work well when using self joins as such records can exist at more than one level of the hierarchy.

(855) SEEDCODE
[email protected]
Follow us: