Editing the value of a variable

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

  1. Click Data > Edit Assignments. In the Assignment Editor window, click Edit. The Set Assignment for Current Element window opens.
  2. 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:
      1. Click the Data expression tab.
      2. Expand Variables, and select a variable.
    • To use JavaScript expression:
      1. Click the Script expression tab.
      2. Expand Variables, select a variable, and enter the JavaScript code that can use the variables in the current context.
      3. 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.
      4. 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.
  3. Click OK to close the Set Assignment for Current Element window.
  4. 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:

Variable with a data expression applied to a Text element.

Example

To select the attributes as an absolute number, name, and value, type the JavaScript code as:

"object:"+Absolute Number+
"attribute"+name+
"value"+_value

Feedback