4.2.2 Walkthrough: Freehand Table
The following walkthrough illustrates how you can create a complex data layout by using a freehand table.
Walkthrough
In this example, you will create a custom crosstab that breaks down sales totals both according to individual 'State' and 'Category' combinations, and simultaneously according to 'Order Date' and 'Category' combinations.
In a regular Crosstab, the data is represented with a nested header structure, such as shown below. Note that the aggregated measure ('Total') is represented for every combination of 'State', 'Date', and 'Category'.

Instead, in this example you will create a table where the 'Date' headers are not nested within the 'State' headers, but are rather displayed separately, as shown below.

To create this table, begin by creating a regular Crosstab that contains just the 'State' and 'Category' combinations. You will then convert this table to a Freehand Table, and use basic Freehand Table techniques to add the 'Date' headers.
Follow the steps below:
1. Press the 'New Viewsheet' button in the Visual Composer toolbar. This opens the 'New Viewsheet' dialog box.
2. Expand the 'Data Source' node, and then expand the 'Orders' sub-node. Select the 'Order Model' data model, and press 'OK'. This creates a new Viewsheet based on the 'Order Model' data model.
3. Drag a 'Crosstab' component from the Components panel into the Viewsheet.
4. Press the 'Edit' button at the top-right of the Crosstab to open the binding dialog box.
5. From the Data Source panel, drag fields from the 'Order Model' into the binding dialog box in the following way:
a. Drag the 'Product.Category' field to the 'Row Header' panel.
b. Drag the 'Customer.State' field to the 'Column Header' panel.
c. Drag the 'Product.Total' field to the 'Measure' panel.
d. Click the Customer.State' field in the 'Column Header' panel to select it. From the 'Ranking' menu in the bottom panel, select 'Top'. Enter '10' as the number of groups. (This will return the top 10 groups according to the summed total.)

e. Press 'Apply' to close the binding dialog box. This creates a new Crosstab in the Viewsheet.

6. Right-click the Crosstab, and select 'Convert to Freehand Table' from the context menu.

7. Click the top-left corner cell of the table to select it. Type the text “Category” into the cell.

(Optional) Use the Visual Composer toolbar buttons to make the text large and bold.
8. Shift-click to select all of the 'State' cells in the header row. Press the 'Fill Color' toolbar button, and specify a light blue background.

9. You will now use freehand table operations to add the 'Date' headers to the table. Follow the steps below:
a. Press the 'Edit' button in the top-right corner of the Freehand Table. This opens the binding dialog box.
b. Right-click the top-right corner cell and select 'Append Column' from the context menu. This adds a new column.

c. From the 'Order' node in the Data Source panel, drag the 'Date' attribute to the new top-right corner cell of the table diagram. This adds the 'Order.Date' attribute as a column header.

d. Click to select this new 'Order.Date' cell. Next to the 'Expand Cell' option in the bottom panel, select 'Horizontal'. This sets the year groups in the 'Order.Date' field to display horizontally, as multiple columns headers.
e. Select the 'Group' option and press the adjacent 'Edit' button. From the 'Level' menu, select 'Year' and press the green 'Apply' button.

f. Press the green 'Apply' button at the top of the binding dialog box to close the dialog box.
g. Expand the table so that you can see all columns. Shift-click to select all of the 'Date' headers. Press the 'Fill Color' button in the Visual Composer toolbar and set a yellow background for the 'Date' headers.

10. You will now use freehand table operations to add an aggregate 'Total' measure corresponding to the year groups. Follow the steps below:
a. Press the 'Edit' button in the top-right corner of the Freehand Table to reopen the binding dialog box.
b. In the Data Source panel, expand the 'Product' node, and drag the 'Total' attribute to the bottom-right corner cell of the table diagram. This adds the 'Product.Total' attribute as a measure.

c. Select this new 'Product.Total' cell, and enable the 'Summarize' option in the panel below. Press the adjacent 'Edit' button, select 'Sum' from the 'Aggregate' menu, and press the green 'Apply' button. This will aggregate the totals for each combination of 'Category' and 'Date'.

d. Press the green 'Apply' button to close the binding dialog box.

11. Observe that the 'Category' row headers are currently sorted alphabetically (e.g., Business, Educational, Games, etc.). To sort the categories by the value of the corresponding aggregate total, follow the steps below:
a. Press the 'Edit' button in the top-right corner of the Freehand Table to reopen the binding dialog box.
b. Click to select the grouped 'Category' cell (bottom-left cell in the table diagram).
c. Press the 'Edit' button adjacent to the 'Group' option. From the 'Sort' menu, select the option 'By Value (Desc)', and press the green 'Apply' button.

d. Press the green 'Apply' button in the binding dialog box to close the dialog box. Observe that the categories are now shown in descending order according to the totals (e.g., Business, Hardware, Personal, etc.).

12. Add a row of grand totals at the bottom of the Freehand Table. Follow the steps below:
a. Press the 'Edit' button in the top-right corner of the Freehand Table to reopen the binding dialog box.
b. Right-click on any cell in the bottom row of the table diagram, and select 'Insert Rows/Columns'. This opens the 'Insert Rows/Columns' dialog box.

c. Configure the settings to insert one row 'After the Selection', and press 'OK'. This inserts a new row into the table diagram.

d. Right-click on one of the 'Product:Total' cells, and select 'Copy' from the context menu.
e. Right-click in the empty cell below one of the 'Product:Total' cells, and select 'Paste' from the context menu. This places a copy of the 'Product:Total' field into that cell.

f. Repeat the above step for the empty below the other 'Product:Total' cell.
g. Click to select the 'Product.Total' cell at the center of the table diagram. In the 'Row Group' and 'Column Group' menus, select the 'default' options, and press the green 'Apply' button.

The 'Row Group' and 'Column Group' settings for a cell determine how the cell will respond to the expansion of other cells. To anchor the selected cell to a expanding grouping cell (so that the selected cell will observe the same grouping as it expands), select the name of the desired grouping cell in the 'Row Group' or 'Column Group' menu.
The 'default' option for 'Row Group' selects the nearest candidate grouping cell (if one exists) in the same row and to the left of the selected cell. In this example, the 'Product.Category' cell provides a candidate row grouping cell in the same row as the selected 'Product.Total' field. Therefore, in this case the 'default' option in the 'Row Group' menu is equivalent to 'Product.Category'.
The 'default' option for 'Column Group' selects the nearest candidate grouping cell (if one exists) in the same column and above the selected cell. In this example, the 'Customer.State' cell provides a candidate column grouping cell in the same column as the selected 'Product.Total' field. Therefore, in this case the 'default' option in the 'Column Group' menu is equivalent to 'Customer.State'.
h. Specify the same 'default' options for the other 'Product.Total' cells.
i. Double-click in the bottom-left cell of the table, and enter the text “Totals”.

13. Expand the table as needed to show all rows and columns.

| << Creating a Freehand Table from an Existing Table or Crosstab | © 1996-2013 InetSoft Technology Corporation (v11.5) | 4.2.3 Freehand Table Properties >> |