CCHierarchy

Integration

Can I Rename the CCHierarchy File?

Yes. It is best to do this by hand, however, and not to use FileMaker Developer. FMD isn’t very good with files separated into separate folders as the Demonstration Files for the hierarchy are. Here is the best way we’ve found to rename the CCHierarchy file.

First, open the hierarchy as normal and select each of the demonstration files form the Window menu: rename the file reference to CCHierarchy there first (even though there is no renamed file yet- just edit the path to CCHierarchy.fp7 to reflect the new name). This will beep at you and say it can’t find the file- don’t worry about it and just escape past that.

Once you’ve renamed all the file references to CCHierarchy.fp7 in the demonstration files, close the solution and rename the CCHierarchy.fp7 file itself.

You’ll also want to edit the script “Navigate (when Hierarchy itself is a menu item)” in CCHierarchy. This has the file name (window name) hard coded into it.

That’s It!

Can I Place a Hierarchy in My Own File?

Pro Version Only.

Sure. Click on the Examples tab and navigate to page 2 to see the “Project List example. This example shows a hierarchy running in another file and contains instructions for adding one to your own files. (This example is only included in the Pro Version of CC Hierarchy.)

Can I Pass a Value When a Hierarchy Item Is Selected?

Pro Version Only.

Sure. In fact, both the Value Lists, and Project List examples make use of the “Value” attribute of a hierarchy item in. The value of a selected item is set to Hierarchy:HrcyKeySelectedItemValueGlob1 (or HrcyKeySelectedItemValueGlob2 if you’re running a second hierarchy). Since these are global fields, you can access them without relationships in any file that has a table occurrence for “Hierarchy” on its graph.

Check out the Value Lists, and Project List examples to see how we pass this value in two different contexts.

What Changes Do I Need to Make to My Files to Use CC Hierarchy’s Navigation?

Adding Navigation to Your Solution. The procedures here are nearly the same in the Free and Pro version, though the Free Version’s navigation lacks the “back” and “fwd” buttons of the Pro Version as well as the Pro Version’s hierarchy driven “new”, “list”, “find” etc. buttons.

Quick Start

Experienced developers can add navigation to your solution in 5 quick steps. More detailed instructions follow below. You'll also want to read "Gong Further" at the end of this entry for some more information about adding navigation to your file(s). You'll perform the following steps once for each file in your solution (CC Hierarchy can navigate through single file or multi-file solutions)...

1. Create a File Reference for CC Hierarchy in your file. Name the reference "Hierarchy". Create one table occurrence from the HierarchyGlobals table in the CCHierarchy file. Leave that table occurrence named "HierarchyGlobals"; you do not need to make any relationships to this table occurrence.

2. Import the Navigation Scripts into your file from the example file "Clients". Select all the scripts from "## Hierarchy Navigation..." through "Button Tab". These will import without errors and you don't have to edit any of them.

3. Add your file to the "Navigate (Go to File)" script in CC Hierarchy. You'll duplicate or edit one of the existing ElseIf steps for each file in your solution, performing your newly imported "Navigate" script in each case.

4. Create Navigation Records for your Solution in CC Hierarchy. Navigate to the Hierarchy Tab of CC Hierarchy and create one new record for each layout you'd like to navigate to in your solution. Remember that you can rename and resort these later. For each item add a file name, layout name, and nickname in the Navigation section. Remember that your file name should not include the .fp7 extension.

5. Add buttons to your file. Copy the "Back", "FWD", "New", "List" etc. buttons from the example file and paste them into your file. These items won't require any editing. For any buttons you already have that you'd like to turn into navigation buttons, simply edit these buttons to perform the script "Button Tab" in your file: for a script parameter, send the hierarchy's nickname of the navigation record you'd like to go to.

That's It!

More Detailed Instructions

What You'll Need

Almost all of the items you need to add to your solution can be copied or imported from one of the Demonstration files. In this Example we'll be hooking up the Simple Tabs example so you'll want to have moved CC Hierarchy to the same folder as the solution you'll be working on (so that CC Hierarchy is right next to your files). You'll also want to (temporarily) move the Demonstration files folder to this same location (so that the Demonstration Files folder is right next to CC Hierarchy, which is right next to your files). Now you can open CC Hierarchy and open your solution; the "Clients" and "Jobs" files from the Simple Tabs example will open automatically.

Note that you can edit the "Upon Opening" script in CC Hierarchy to prevent these example files from opening each time you open the hierarchy.

1. Create a Table Occurrence for "Hierarchy Globals" in your file.

Click File / Define File References from FileMaker's File menu and the click New. Click Add File in the upper right and select CC Hierarchy from the file dialog presented. Once you've selected the file, name the reference "Hierarchy" where it says "File Reference Name" and click OK at each of the screens until you're back at your solution. Go to the relationship graph in your solution and click the green plus-sign button in the lower left of the screen; this will begin the process of creating a new table occurrence on your graph. From the "Specify Table" window, change the "File:" to be CCHierarchy and select the "HierarchyGlobals" table and click "OK".

2. Import the Navigation Scripts.

Open the ScriptMaker in your solution and select "Import". Select the file "Clients" from within Demonstration Files / Navigation / Simple Tabs. Place a check mark beside all the scripts from "## Hierarchy Navigation..." through "Button Tab" and click OK. These scripts will all import without errors and you don't have to edit any of them.

3. Edit the "Navigate (Go to File)" script in CC Hierarchy.

Since CC Hierarchy has to actually call scripts within your files, you'll have to add a file reference for your solution to CC Hierarchy. Once you've done that edit the "Navigate (Go to File)" script in CC Hierarchy. Highlight the last pair of ElseIf / PerformScript lines in this script. With both lines highlighted click "Duplicate"; you'll now edit the duplicated lines. Edit the ElseIf line so that your file name follows the equals sign (your file name should be in quotes and should NOT have the .fp7 extension). Now edit the Perform Script line. Highlight that line and click "Specify"; change the file name at the top of the dialog to be the name of your file (from the file reference you created at the beginning of this step). Then select the script "Navigate" from your file (you imported this script into your file in the previous step). Leave the script parameter alone. Note that if you have a multi-file solution, you'll need to repeat this procedure, creating an ElseIf / PerformScript pair for each file in your solution.

4. Create Navigation Records for your Solution in CC Hierarchy.

Navigate to the Hierarchy Tab of CC Hierarchy and select the last top level item in the hierarchy. Click "New Item" to create a new, top level item. Name this item "My Solution". Now, with this new item selected, hold down the shift key and click "New Item" again to create a child of that "My Solution" record. This record will represent the first layout in your solution- remember that you can rename and reorder these hierarchy items later. For now, just create entries for a few layouts to make sure everything is working. Using the fields in the right half of the Hierarchy tab, give this item an Item Name that you'd like to see in your solution's menu. Then, in the navigation section, add a file name, layout name, and nickname in the Navigation section. Remember that your file name should not include the .fp7 extension. If you enter a file name or layout name incorrectly, CC Hierarchy will tell you it can't find the item so be sure to spell your file and layout names correctly. (The record's nickname is what you'll be referencing when you ask to navigate to this item from your solution in the next step.)

Once you've added an item, click "Go to Item" beneath the Navigation options in the right hand side of the Hierarchy tab. This will let you test that you've added everything correctly. The most common error at this point is having misspelled the file name in the script editing from Step 4. Go back and double check that if you have errors.

Continue adding hierarchy records for the remaining layouts in your solution.

5. Add Buttons to Your File(s).

Copy the "Back", "FWD", "New", "List" etc. buttons from the example file and paste them into your file. These items won't require any editing and will work as soon as they are pasted into your file. You'll want to place these on every layout you'll navigate to, so eventually you'll want to edit the look and feel of these to match your solution. For now, just paste them as-is onto a few layouts so you can play around with this.

For any buttons you already have that you'd like to turn into navigation buttons, simply edit these buttons to perform the script "Button Tab" in your file: for a script parameter, send the hierarchy's nickname of the navigation record you'd like to go to. Take a look at the "Contacts" and "Jobs" buttons as an example.

For buttons that need to Go to Related Records, take a look at how we've done this in the Client's file. Navigate to the Client's "tab" in the example file and check out the button pointing to contacts in the contact's portal. That arrow calls the "Go to Related Contact" script in our example file; if you look at that script we simply perform a traditional GoToRelatedRecords script step before adding our "Button Tab" script step with the destination nickname as a parameter.

That's It!

Going Further

+List Views+ The Simple Tabs example uses a very basic conceit to move from Form view to List view; it assumes that your list view follow your form views in layout order. If that isn't the case, you'll want to reorder your layouts or go into the Button List script and change it around. Other navigation examples in CC Hierarchy use hierarchy records to define list view layouts- this also puts list views in the Back stack- so feel free to check out those Button List scripts for ideas. The approach taken in Simple Tabs is nice and economical; it also keeps your list views out of the menu, which can be nice.

Dynamic Tabs

The simple tabs example assumes that you'll be using static layout objects as your navigation buttons to move from file to file within your solution- or that you'll be relying solely on the hierarchy menu to navigate around your solution. The two "dynamic" navigation examples allow the hierarchy to draw tabs in your solution files: tabs that you can use to move from layout to layout. Incorporating one of these dynamic examples into your files is very similar to the steps outlined above. There are a few differences in each step, however, and those are enumerated below (these steps are the same for both the Dynamic Tabs and the Dynamic "Aqua" Tabs examples):

Step 1. Since the dynamic examples draw tab graphics that are stored in the Interface table of CCHierarchy, you'll need to add a table occurrence for the Interface table as well as one for the Hierarchy Globals table. Name this table occurrence "Interface"; you don't need to create any relationships to it.

Step 2 and 3. There are no changes to these steps.

Step 4. You'll create your hierarchy records much the same as in step 4. However you'll also be using the check box at the bottom of the Navigation section labeled "Make this a tab of...". Once this is checked, the selected item name will be one of the tab names within its parent's section. The code in CC Hierarchy supports up to 10 tabs per section (per parent record) but our example files only show 7 tabs. Play around with the demonstration files to see how these tabs work: note that tabs respect the sort order of the hierarchy.

Step 5. The basic difference here is that in addition to adding the "Back", "New", etc. buttons, you'll be copying and pasting the actual tabs as well, along with the found count navigation display and arrows.

Step 5 part 1. Get ready for this by creating a field like ClientRecordNumberCalc in each data table in your solution... you can find the definition for this field in the Demonstration files. This is the field used to display the current record number and the current found set count (1 out of 245, etc.) Note that this is a repeating calculation: be sure to define it to have two repetitions and to return the type "number"). The field's definition is not table specific, so you can just paste the definition in without editing it. Be sure to edit the field's storage options and set the field to "Do not store calculated results."

Step 5 part 2. When you copy and paste your objects you can paste all the tabs as well. Note that these tabs do not need to be edited at all, even the button actions associated with them will resolve correctly. The only thing that won't resolve correctly are the record number strings between and to the right of the previous and next record arrows. Double click on these and select the correct "...RecordNumberCalc" field for the table the current layout is based on. When you edit the second occurrence of this field (the one to the right of the "next" record arrows) be sure to select "Field Format" and show the 2nd repetition of the field (from repetition 2 to 2).

Step 5 part 3. While the tabs will be correct as soon as they are pasted in, you have to navigate through the hierarchy at least once before the tabs will work. To do this, enter browse mode and click the menu button. Select one of your layouts in the hierarchy and, having navigated to it, your tabs will be loaded and you'll be all set to go. Note that this has to happen each time you open your solution (the tab names have to be loaded into the hierarchy 's global fields) so you'll want to create an Upon Opening script like that used in the Example files to "pre-navigate" as the system opens. In a sense, this script is just using the hierarchy to determine which layout the system should open to.

That's It!

(855) SEEDCODE
[email protected]
Follow us: