Walkthrough: Formula Table Expansion

Walkthrough

Construct a formula table based on the 'customers' query, with a multilevel header comprising 'State' and 'City'.

1. Click the 'New' button in the Style Studio toolbar. This opens the 'New Asset' dialog box.

2. In the left panel, select 'Report'. In the right 'Types' panel, select 'Blank Tabular Report' and click 'OK'.

3. Expand the Style Studio Toolbox panel, and drag a Table element into the report. This creates a new blank Table.

4. Right-click the table, and select 'Table' > 'Convert to Formula Table' from the context menu.

5. Right-click the table, and select 'Table' > 'Insert Rows/Columns' from the context menu.

6. Add two additional rows so that the table has four rows. The table should now have four rows and two columns

7. Click away from the Table to deselect it.

8. Expand the Style Studio Properties panel. (Select 'Properties Pane' from the Style Studio Window menu.) Click the Script tab in the Properties panel.

9. Select the 'onLoad' button in the Script tab, and enter the following script:

var q = runQuery('customers');

This executes the 'customers' query in the onLoad script. (See Extracting Data from a Query for more details.)

10. Select cell[1,0] (second row, first column). Click the Data tab in the Properties panel.

a. In the 'Binding' panel of the Data tab, select the 'Formula' option. Enter the formula 'toList(q['state'])'.

b. In the 'Expansion' panel of the Data tab, set 'Expand Cell' to expand 'Vertical'.

c. In the 'Cell' panel of the Data tab, set the 'Cell Name' to be “st”.

The Data tab of the 'Format' panel should still be open.

11. Select cell[2,1] (third row, second column).

a. In the 'Binding' panel of the Data tab, select the 'Formula' option. Enter the formula 'toList(q['city@state:$st'])'.

b. In the 'Expansion' panel of the Data tab, set 'Expand Cell' to expand 'Vertical'.

c. In the 'Cell' panel of the Data tab, set the 'Cell Name' to be “ct” and set the 'Row Group' to 'st'.

The table should appear as shown below.

 

12. Preview the table.

 

This example continues in the next section, Pre-Expansion Script, where you will add visual formatting to the table prior to expansion.

See Also

Creating a Formula Table Using Script (Advanced), in Report Design, for basic information on cell expansion.

<< 3.7.6 Visual Properties © 1996-2013 InetSoft Technology Corporation (v11.5) Pre-Expansion Script >>