3.1.5 Using a Variable
You can use a Variable from the Asset Repository in the filtering condition of a Worksheet Data Table, Named Condition, or Named Grouping. Follow these steps:
1. Drag the Variable from the Asset Repository into the Worksheet where it will be used.
2. Open the 'Conditions' dialog box for the table, Named Condition, or Named Grouping.
3. Select the 'Variable' option, and choose the desired Variable from the menu.

When you bind a Variable to a table in a Worksheet (either directly through the table's filtering condition, or indirectly through a Named Condition or Named Group that is linked to the table), a user will be prompted to supply the Variable value when they do one of the following things:
• Open the Worksheet in Visual Composer or Style Studio
• Save the Worksheet in Visual Composer or Style Studio
• Click the 'Enter Parameters' button in the Worksheet toolbar
• Open or preview a Viewsheet linked to the Worksheet (only if Viewsheet's 'Disable Prompt Parameter' option is deselected, and no default is specified for the Variable)
• Open or preview a report that uses the table linked to the Variable
See Also
Filtering, for details on setting conditions.
Setting Viewsheet Options, in Dashboard Design, to enable Viewsheet prompting.
Creating a Named Condition, for details on Named Conditions.
Creating a Named Grouping, for details on Named Groups.
This example continues the example in Defining a Variable. Assume you have a table listing the summarized information of the sales for all states and you are interested in working with the total sales value for only one particular state at a time. This can be achieved by adding a filtering condition on the 'State' field of the table to be equal to the value of the 'State' Variable.
Instead of creating a new 'State' Variable for this Data Worksheet, you can use the existing 'State' Variable from the Asset Repository (see Defining a Variable).

1. Create a new Worksheet.
2. Expand the 'Data Source' node, and then the 'Orders' node.
3. Drag the 'sales by state' query onto an empty cell on the Worksheet. This creates the table 'sales by state1'.
4. Expand the 'Global Worksheet' node.
The Variable name is shown in italics to indicate that the asset is referenced from another Worksheet.
5. Select the 'State' Variable and drag it onto an empty cell in the Worksheet. This imports the variable into the Worksheet as 'state1.'


6. Click on the 'Condition' button, located in the title row of the 'sales by state' table. This opens the 'Condition' dialog.
7. Deselect the 'Advanced Conditions' box.
8. Click the 'More' button to add a new condition.
9. Select 'State' from the fields drop-down list.
10. Select “is equal to” as the condition operator.
11. For the value, specify that it is a Variable by clicking on the down arrow button to the right of the value text field and selecting 'Variable'.

12. From the menu to the left of the down arrow, select 'state'.

13. Click on the 'OK' button.
14. You will be prompted for the value of the 'state' Variable. Specify “FL” to be the parameter value and click on the 'OK' button.

15. Preview the table (see Previewing a Table), and note that only the sales for the state of Florida are now shown.
| << 3.1.4 Using a Date Range | © 1996-2013 InetSoft Technology Corporation (v11.5) | 3.2 Saving an Asset >> |