You can assign a variable to a data expression, a JavaScript expression, or a simple value. When you are editing the variable, you can use only
the data attributes and variables that are visible in the current context.
Procedure
- Click . In the Assignment Editor window, click
Edit. The Set Assignment for Current Element window
opens.
Note: The Set Assignment for Current Element window displays Data
Expression tab with Attributes node in expanded form without any
selection, making it easy for the template designer to select the attribute. If the template element
is not within any query context, then the Simple Value tab displays by
default.
- Enter a value:
- To use a Data expression:
- Click the Data expression tab.
- Expand Variables, and select a variable.
- To use JavaScript expression:
- Click the Script expression tab.
- Expand Variables, select a variable, and enter the JavaScript code that can use the variables in the current context.
- If you copied the script from XHTML, you can select the XHTML Input
option to allow the XHTML tags that are contained in the script to be edited.
- If you are generating the template into XHTML output, you can select the XHTML
Output option to parse the script and render the script as rich text.
- To use a Simple value, click the Simple value tab, type a value, and
then click OK. For example, Header Title.
-
Tip: If you rename a variable, the name is not updated in a script
expression or native filter and creates a reference error. When you rename a variable, ensure that
you revise the name in the script expressions and native filters as well.
- Click OK to close the Set
Assignment for Current Element window.
- Click OK to close the Assignment
Editor window.
Results
If you added a data or script expression, an example variable in the element might
look like this in the template:
Example
To select the
attributes as an absolute number, name, and value, type the JavaScript code as:
"object:"+Absolute Number+
"attribute"+name+
"value"+_value