You can assign a variable a simple value, a data expression,
or a JavaScript expression.
When 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.
- Enter a value:
- To use a Simple value, click the Simple value tab,
type a value, and then click OK. For example, Header
Title.
- 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 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.
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