Start page / Template development / Rules / Logical expressions / <OR/>

<OR/> OR operations in dynamic forms

The <OR/> tag can be implemented in the value determination area of the rule definition (or for the definition of a precondition) and is used to link multiple logical expressions. The result of combined logical expression is a Boolean value, which is true when at least one of the linked expressions is true:

<OR>
Expression 1
Expression 2
...
Expression n
</OR>

The <OR/> tag is used to check multiple form properties in a rule and to link them with a handling instruction, e.g.:

  • “If the form was opened in the page store OR site store, the form content A is displayed.” or
  • “If the value of the input component is less than 0 OR greater than 10, a message appears in the form.”

Examples

Example: Displaying a form element only in particular stores

A metadata template contains the (CMS_INPUT_TEXT type) input component “st_keywords”. A dynamic form is used to ensure that the input component is displayed only when opening the form in the page or media store and hidden in all other stores. This is ensured when the expression <PROPERTY source="#global" name="STORETYPE"/> returns the value “pagestore” or “mediastore”. These conditions are checked in the <WITH/> section of the rule as follows:

<WITH>
<OR>
<EQUAL>
<PROPERTY source="#global" name="STORETYPE"/>
<TEXT>pagestore</TEXT>
</EQUAL>
<EQUAL>
<PROPERTY source="#global" name="STORETYPE"/>
<TEXT>mediastore</TEXT>
</EQUAL>
</OR>
</WITH>

If one of these logical expressions is true, the condition (Form opened in page or media store) is fulfilled. The expressions can therefore be linked using <OR/>. The result of the combined logical expression is a Boolean value, which is then combined with a handling instruction in the <DO/> section. As long as one condition is fulfilled, the form content “st_keywords” is made visible “visible” using a <PROPERTY/> tag in the handling instruction:

...
<RULE>
<WITH>
<OR>
<EQUAL>
<PROPERTY source="#global" name="STORETYPE"/>
<TEXT>pagestore</TEXT>
</EQUAL>
<EQUAL>
<PROPERTY source="#global" name="STORETYPE"/>
<TEXT>mediastore</TEXT>
</EQUAL>
</OR>
</WITH>
<DO>
<PROPERTY source="st_keywords" name="VISIBLE"/>
</DO>
</RULE>
...

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.13 | Data privacy