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 Set Condition for Current Element window, expand Variables and Attributes in the left pane.
  2. Select the check box for the attribute or variable to be set.
  3. Select the value for Left operand, Operator, and Right operand from the list in the right pane.
    Note: When the left operand and right operand of a condition are from same attribute name, but belong to two different queries, the condition does not work. You have to set different aliases for the two attributes for the condition to work in the following example below.
  4. Click Add. The selected condition is added in the text box.
  5. Optional: Click Test to test the condition before applying it to the current element.
  6. 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.

Results

The condition you selected is applied to the current element in a template.

Example

How to use the Alias feature in Rational® Publishing Engine Document Studio

Here is a solution for a problem when you are using attributes with the same name. First you need to have No option checked in IBM® Rational Publishing Engine Document Studio Preference Page for Use schema annotations for display. In order to show the advantages of the Alias feature, DOORS schema provided with IBM Rational Publishing Engine is modified. This is the default DOORS schema:
  1. Rational Publishing Engine Document Studio, click Window > Preferences.
  2. Expand RPE and click RPE Document Studio.
  3. Select No under Use Schema annotations for display and click OK.
In order to show the advantages of the Alias feature, the DOORS schema provided with Rational Publishing Engine is modified. An example of the default DOORS schema:

An example of the modified schema (observe the selected description attribute):

You want to display all the DOORS attributes that have the same description with module's description. In this context when the need is to use attributes with the same name - case sensitive, Rational Publishing Engine cannot process the condition in the correct way. You can use the Alias feature to eliminate ambiguities. When adding the condition that verifies if the module's description equals the description of the DOORSAttribute, right click on the attribute to set this alias.

Now the module/attribute/Description attribute will be known as $1_Description and the condition will be processed correctly.

Tip: To examine how the condition is applied to the data, click Test which will provide a new dialog box. In that box, you would be able to fill in or leave blank a value for the Object_Heading attribute. Click Run.

Feedback