< Back
Print

Working with placeholder in conditions

You can use placeholders in conditions as well. You can use them to dynamically define a value your condition is compared to or you can define them as a return value if your condition is met/not met.

Notice: In 1.1. Getting started – Setting conditions, you can find the general documentation about setting conditions.

UseCase #1: Using placeholders as comparison value

If the value you need your condition to be compared to is dynamic, you can use placeholders to define that dynamic value.

Example configuration:

Use the option “firmly set check value” and enter your placeholder name in brackets in the corresponding “Value” text area. In the placeholder map below, define the placeholder. Please note that in order for this to work the placeholder name and the name of the placeholder in the “Value” text area MUST match (see red arrow above).

In example above, the placeholder is derived from the attribute “EAN code” which we formatted using the “format strings” plugin, for example because we need to skip the first 3 characters from the EAN code and compare that value to our condition.

UseCase #2: Using several placeholders as comparison values

Another way to use placeholders (espescially if you need to compare several values) is to use the condition group option “Set condition for placeholder values”

Example configuration (click to enlarge):

In this case the Connector will compare placeholder3 (=firmly set check value) with placeholder1 first and – if that value is empty – compare it with placeholder 2. Placeholder2 will not be used for comparison if placeholder1 contains a value. Again, placeholders must be dedined in the placeholder map and names must match!

 

Please note: the nomenclature {placeholder1|placeholder2} (that is, several placeholders separated by the pipe sign) always means an “OR” connection. The placeholder set first will be used if it has a value, if not, the placeholder following the pipe will be used next. The order in which you indicate placeholders within brackets defines the order in which they will be used for comparison (if used within a condition) or as a return value (if used with the “Return placeholder” action of conditions).

UseCase#3: Returning placeholder values as a result

 

Using conditions and placeholders also allows you to return a placeholder if a certain condition applies.

 

Example configuration:

Set the action “Return placeholder value if…” and apply your condition. Define placeholders and their formatting options and in the text area “return of a placeholder value as defined in the placeholder map”, define the return value using the placeholders.

 

Our example above will return the placeholder values as defined if the text attribute teaser is empty. Placeholder1 will be returned separated by the static ” abc ” and placeholder3 IF placeholder1 has a value. If placeholder1 has NO value, placeholder2 will be returned.

 

Please note: the nomenclature {placeholder1|placeholder2} (that is, several placeholders separated by the pipe sign) always means an “OR” connection. The placeholder set first will be used if it has a value, if not, the placeholder following the pipe will be used next. The order in which you indicate placeholders within brackets defines the order in which they will be used for comparison (if used within a condition) or as a return value (if used with the “Return placeholder” action of conditions).

 

Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents