Using Example Two

Tips for showing different found sets of top level records.

Example Two of SeedCode Hierarchy shows a "filter" field where you can type a few letters of a company name in order to restrict the top level records (companies) to just those companies that match the filter. When you integrate this into your file you can filter on any field in your top-level table.

Under the hood, we're searching for these records in the script "Build Found Set for Top Level { Show }" and you'll likely want to read more about how this script builds found sets of top level records.

Remember that you don't have to show a filter field to your users in order to filter the hierarchy; you can have buttons that do the same thing. So if you wanted to have a button that showed only active companies, for example, you could have button that called the script "Build Hierarchy { Open Top or Open All }" with a script parameter like this:

Let ( [ $$Hy_Show = "Filter" ; $$Hy_FilterBy = "Active" ] ; "" )

You'd then edit the script " "Build Found Set for Top Level { Show }" as follows:

Find the comment that says "Filter by different fields if necessary."
After that you'll see an Else If () statement that currently says $$Hy_FilterBy = "Something Else"; change "Something Else" to "Active".
Then, in the following SetField step, specify the Target Field to be your version of a field like "CompanyIsActive". Then set the Calculated Result of the same SetField step to be whatever value indicates "activesness": probably the word "active" or a "1".

What happens when the filter is blank?

When you clear the filter we revert to the hierarchy's default contents. These are defined in the script "Set Default Contents". You can edit that script to change this default behavior.

If you want the hierarchy to be empty when the filter is emptied, edit the script "Filter Hierarchy" and find the comment "If so, show the default hierarchy records." Delete the next step where we preform a script and instead set the variable $$Hy_Show to 0 (i.e. to zero).

[email protected]
Follow us: