A.1.3  Variables

A variable can be added to an expression where a value is expected. The variable does not need to be declared. Whenever a variable notation is encountered, the variable is implicitly declared. If a variable is used without any further definition, it defaults to the string type, and the end user enters its value when the query is executed.

location.state = $(state)

The name of the variable can be quoted in the parentheses. This allows reserved words to be used as the variable name.

price = $('max')

If the quote were not used, the expression parser would generate an error because the word 'max' is used for the aggregate function and is not recognized as a regular variable name.

All variable references to the same name in all expressions used in a query are considered to be the same variable. Variables are never shared across queries, regardless of their names.

A variable can be formally defined in a query. The variable definition sets the follow variable attributes:

Alias
Variable label used when prompting end users for the variable value.

Type
Variable data type. The type determines the component used for entering the variable value and the type of the entered value. For example, if a variable is defined as a date type, a date combo box is used to enter the variable value and the entered value is a java.util.Date object.

Value
Variable default value.

A variable can also be defined as a query-based variable. In this case, the value of the variable is derived from the result of another query and the end user is not prompted for the value.

<< A.1.2 Node Attributes © 1996-2013 InetSoft Technology Corporation (v11.5) A.2 Constant Values >>