Walkthrough: Defining Formulas
Walkthrough
The Freehand Table Layout allows you to define a formula within a cell, similar to a spreadsheet application. The example below demonstrates this feature:
1. Click the 'New' button in the Style Studio toolbar. This opens the 'New Asset' dialog box.
2. In the left panel, select the 'Report' node. From the right 'Types' panel, select 'Blank Tabular Report', and click 'OK'
3. Expand the Style Studio Toolbox panel.

4. Click the 'Table' button in the Toolbox panel to open the 'Data Binding' dialog box for a new table.
5. Under the Data tab, bind the table to the 'Order details' query from the 'Orders' data source. Under the Columns tab, select all of the columns. Click 'Finish' to perform the binding.

6. Select the last column in the table, right-click on the column, and select 'Column' > 'Append Column' from the context menu. This adds an additional column.

You will use this new column to calculate the profit/gain to a customer who has obtained a discount.
7. Select the header cell of the new column and type “Profit/Gain”.

8. Expand the Style Studio Properties panel.
9. Select the detail cell of the new column.
10. In the Properties panel, click the Data tab. Select the 'Formula' option in the 'Binding' panel, and click on the 'Edit' button to open the Script Editor.
11. In the Script Editor, enter the following formula:
field['Price']*field['Discount']

12. Click on the 'Save and Close' button, then click the 'Apply' button in the Data tab.


13. Preview the report to observe the effect. (Page forward in the report to see the non-zero values of 'Profit/Gain'.)

14. Save the report.
| << Walkthrough: Freehand Operations on a Table | © 1996-2013 InetSoft Technology Corporation (v11.4) | 6.5 Binding Data to a Crosstab Element >> |