Pre-Expansion Script

Walkthrough

This section continues the example from the previous section (Walkthrough: Formula Table Expansion). In this example, you will format the 'State' rows with a red background color, and format the 'City' cells with a yellow background color.

It is easiest to color these cells using pre-expansion script, because the formatting that you add to pre-expansion rows and cells is repeated for all corresponding rows and cells in the post-expansion table. Thus, the automatic table expansion takes the place of the Iteration Statements that you would otherwise need to write.

To add the pre-expansion script, follow the steps below:

1. Right-click anywhere on the table and select 'Script' from the context menu. This opens the Script Editor to edit the element script.

2. Add the following script to the table element.

rowBackground[1] = [255,0,0];

cellBackground[2][1] = [255,255,0];

expandCalcTable();

The first line of the script specifies a red background for the second row of the pre-expansion table (the row containing 'State'). The next line of the script specifies a yellow background for the cell in the third row, second column of the pre-expansion table (the row containing 'City'). The third line of the script initiates table expan­sion, which propagates the specified formatting to all correspond­ing cells in the expanded table.

3. Click 'Save and Close' to exit the Editor.

4. Preview the result.

 

This example continues in Post-Expansion Script, where you will add post-expansion script to modify some further table properties.

<< Walkthrough: Formula Table Expansion © 1996-2013 InetSoft Technology Corporation (v11.5) Post-Expansion Script >>