Learn more about the differences between conditions and conditional values in Outputs.




When creating outputs, it may be confusing to see both a 'Add conditions' option and an option labeled 'Condition' when building an output value. This article explains the differences. 


Both (general) conditions and conditional values are built on the same condition module. However, they differ in a few aspects and mainly in their application. 



Condition module

A condition module is a Boolean that evaluates a comparison/logical expression and returns a result. If the result of the expression or expressions is true, the first-case match applies and if the result is false, the following case or default case is considered.

 

Within the condition module, you can also create multiple sub-conditions and combine them into groups. Groups can also be nested within other groups and have their own scope.





Conditions

Conditions are applied at the output value level and help you define in which specific case an output value should be generated

 

This is useful when used with multiple output values.

Indeed, if none of the conditions are met, no output value is returned and hence, no output is generated at all. 




Example 1 - Conditions

Let's say we want to generate a tracking URL whenever Medium is not Display. 

 

In this example, we added a condition to the output value 'Tracking URL'. This means that a tracking URL is generated whenever the Medium field is not Display. 

 

If the condition is not met, no output would be generated at all. 

 



Example 2 - Conditions

Let's say we want to generate a tracking URL whenever Medium is not Display. Otherwise, we want to generate a name set.

 

In this second example, we have the same case as example 1 - Tracking URL with a condition. But we also added another output field with an unconditional output value that works as a default value. 



In this scenario, the tracking URL is generated whenever the Medium is not Display. Else a name set is always generated. 




Conditional values

Conditional values are applied at the value component level and define which value should apply in a specific case.

 

This is useful when you have a combined value (made of many single values) and need to apply different cases to one component only. E.g., as part of Join and Build URL.

 

If none of the conditions are met, an empty value string is returned. This does not affect the generation of the output.


On October 31, 2022, we introduced the 'Remove empty query parameters' feature. This allows you to solve part of the for mentioned issue with empty strings.

Parameters with an empty value are automatically removed from the final Tracking URL. 

You can read more about it on these Release notes - Removing empty query parameters in Outputs.



 


Example 1 - Conditional values

In this example, we are going to recreate Example 1 from above:

We want to generate a tracking URL whenever Medium is not Display. However, this time, we use a conditional value.

 

 

From the screenshot, you can see that the tracking URL is generated whenever the Medium input field is not Display. 


This works the same as with conditions and it may seem that conditions and conditional value could be used interchangeably. However, there is a main difference when the condition is not met. 


Indeed, if the condition is not met, an output would still be generated, but it would just be generated as an empty string. 

 

 

Example 2 - Conditional values

In this example we are going to recreate Example 2 from above: 

We want to generate a tracking URL whenever Medium is not Display. Otherwise, we want to generate a name set.


This time, we use the conditional value and set a default value using the in-build feature (instead of creating another output field with output value). 

 


In this scenario, the tracking URL is generated whenever the Medium is Display. Else, if no conditions are met, a name set is built. 

 

However, there is an issue with the output type here. A name set should be a Text field type and not an URL field type as it is defined here. 




Overview of differences

 


General conditions

Conditional values

Level

Output value

Value component

Logic

IF-Then

IF-Then (ELSE)

If no conditions met

No output

Empty value

 

Although there are cases when you could use conditions and conditional values interchangeably. We recommend that you follow a rule of thumb.


  • A condition defines in which cases an output value and hence, an output is generated. 
  • A conditional value defines which value component should apply in a specific case(s).


Condition
If no conditions are met, no output value (and hence, output) is generated.

Conditional value
If no conditions are met, an empty string is returned. However, the output value is still generated.

 

It may be clearer to consider an example where both conditions and conditional values are used in combination. Using both in combination also allows you to add more granularity to when and what values should apply. 



Example - Combined

Similarly to the previous examples, we want to generate a tracking URL whenever Medium is not Display. Otherwise, we want to generate a name set. 

 


However, we can an extra layer of granularity by using conditional values. Depending on whether this is an external or internal campaign, I want two different value types of the clid parameter. 



Let's look at the complete example. 



When Medium is not Display (condition), the output 'Tracking URL' is generated. The tracking URL output value is composed of a Base URL and a sequence of parameters. 


More specifically, the parameters include medium, source, and a clid. The clid is a random value or a default static value depending on whether it is an internal or external campaign (conditional value).


When the first condition is not met, then the output 'Name set' is generated (unconditional).