Using conditions in template elements

Use the condition editor to define a JavaScript expression with the data attributes and variables accessible in the current context.

Procedure

  1. In the template content editor, double-click an element.
  2. In the Set Condition for Current Element window, expand Variables and Attributes.
  3. Select the check box for the attribute or variable to set.
  4. Select values for Left operand, Operator, and Right operand from the dropdown menus.
    Note: When the left operand and right operand of a condition are from the same attribute name, but belong to two different queries, the condition does not work. You must set different aliases for the two attributes for the condition to work.
  5. Click Add. The selected condition is added in the text box.
  6. Optional: Click Test to test the condition before applying it to the current element.
  7. Click OK.
    Note: If you use the tools on the Set Condition for Current Element window, any data attribute or variable used is automatically selected in the left pane. If you enter the condition manually, you must manually select the data attribute or variable.

Using the Alias feature for attributes with the same name

First edit the Document Studio preferences:
  1. Rational® Publishing Engine Document Studio, click Window > Preferences.
  2. Expand RPE and click RPE Document Studio.
  3. In the Use Schema annotations for display field, select No and click OK.

To differentiate attributes with the same name, you can use the Alias feature to eliminate ambiguities. When adding the condition which verifies that the module description equals the description of the DOORSObject, right-click the attribute to set the alias.

Now the Module/Object/Object Text attribute is known as $1_Object Text and the condition can be processed correctly.

Tip: To examine how the condition is applied to the data, click Test. In the Test window, click Run.

Feedback