From SeedCode Documentation

SeedCodeHierarchy: SortOrder

Controlling the Sort Order of Items within the Hierarchy

Sorting of items with the hierarchy is controlled using simple scripts just for this purpose. Open ScriptMaker and within the Hierarchy scripts, find the section called "Data Scripts".

Edit the script that begins "Sort Level...". Each script contains a Sort Records step that is used to determine the sort order in which a record's peers appear in the hierarchy. In each script, double click on the "Sort Records" script step to change the sort order. Make sure the table at the top of the field list says "HierarchyDataLevel1" and then pick the field you'd like to sort your records by: in our example this would be the field "HierarchyDataLevel1::CompanyName". Repeat this for the sort scripts for each level, making sure to select fields from the "HierarchyDataLevel..." TO appropriate to each level.

Note that you can make these scripts conditional if you wish by nesting various sort options within if statements like this:

If [ Something ]
Sort Records [Restore; No dialog]
Else If [ Something Else ]
Sort Records [Restore; No dialog]
End If

When is the Hierarchy Sorted?

The sort order is determined when an item is "built." So the top level items are only sorted when the hierarchy is first drawn (on "build...", "open all", "open top", or "close all"). The whole hierarchy is also sorted when the Outline or Legal formats are applied to the hierarchy.

Items below the first level are sorted on first draw and then when their parents are opened or closed. Note that this is also when newly created records will show up in the hierarchy.

Retrieved from http://archive.seedcode.com/pmwiki/index.php?n=SeedCodeHierarchy.SortOrder
Page last modified on October 10, 2008, at 06:55 PM