Learn how to create a Variable and use it as part of Outputs.
A Variable allows you to store value structures that are commonly used. Once a Variable is configured, it can be reused in multiple output fields to recall what is stored.
This allows you to easily build multiple Outputs that share the same value structure, but also to apply changes to all of them at once.
Indeed, you can create complex combined or conditional values as one Variable. Once created, the Variable can be added as a single block when building Outputs. Finally, whenever changes or corrections are needed, you can do so by editing the Variable - the changes are automatically applied across all instances.
Use case: when your taxonomy or tracking codes often share the same value structure. Instead of building multiple outputs from scratch and editing them one by one, you would do so once from the main Variable element under the Variables tab.
How to create a Variable
From the Output configuration, switch to the `Variables´ tab. Then:
- Add a Variable
- Create and configure a value
- Add the preconfigured Variable to Output fields
> Edit the Variable to apply changes to all instances
Remember that whenever you change a Variable it will affect all instances where it is being used.
Example
Given this is your taxonomy:
- Campaign (name set): Year_Market_KPI_Strategy
- Placement (name set): Year_Market_Audience_Placement-size
- Ad (name set): Content_Audience_Placement-size
You can notice that there are some value structures that repeat - Year_Market and Audience_Placement-size.
Instead of having to build them manually for each output, you can store them in Variables.
Click here for details
Variable 1
Name: Year & market
Structure: JOIN(year, market)
Delimiter: underscore (_)
Variable 2
Name: Audience & placement size
Structure: JOIN(audience; placement size)
Delimiter: underscore (_)
Output field 1
Type: Text
Name: Campaign
Structure: JOIN(variable1, KPI, strategy)
Output field 2
Type: Text
Name: Placement
Structure: JOIN(variable1, variable2)
Output field 3
Type: Text
Name: Placement
Structure: JOIN(content, variable2)
Tip: Each output field corresponds to a column in the Records table. Hence, if you want an output to always be generated, it should be contained in its own output field. In the above example, if we were to place all name sets as different output values in one output field, only one output value would be generated. This would happen because output fields work on a first-match basis. As soon as one case is met, the other cases are discarded.
Click here for step-by-step instructions
1. Create a variable – Example with Variable 1
From the Variables tab:
- Build the variable value – `Add a variable´ > `Join´
- Configure the value
- Name `Year & market´
- `Add output value´ > `Variables´ > Select `Year ´
- `Add output value´ > Single input > Select `Market´
Repeat for variable2
2. Create an output field using variables – Example with Output field 1
From the Outputs tab:
- Select an output field type - `Text`
- Build the output value – `Join`
- Configure the output value
Name `Campaign´
`Add output value´ > `Variables´ > Select `Year & market´
`Add output value´ > `Input field´ > Select `KPI´
`Add output value´ > `Input field´> Select `Strategy´
Repeat for the remaining output fields.
3. Save and publish the configuration
It's good practice to always check that your outputs are correct. To do so, create a test record and validate the output fields.
4. Validate the final outputs - Name sets in this case
From the Create form:
- Fill in the form with dummy values
- Submit
- Verify that the generated name sets match your taxonomy
Creating a (variable) value
Depending on how you use Variables, they could be created as output values or as single values.
Note: By output value, we mean the final value of the output. It can be made of one single value or a combination of single values. By single value, we mean the smallest building block of an output. It can be used alone, combined, or assigned to conditions to build an output value. Learn more about the structure of outputs and value components here.
Nevertheless, the process of creating a Variable is the same as that of building an Output. Please, refer to this article, point 2 for a more exhaustive explanation.
Here below is a short, adjusted version:
- Build the variable value
Choose whether the value of the variable is composed of a single value or multiple values.
- Configure the value
Specify and configure the single components of the value. This differs depending on the value structure.
- Apply Rules (optional)
A rule is a transformation that modifies the data to conform to a certain format and/or pattern.
- Add conditions (advanced)
A condition is a logical comparison that must be met for something to into effect.
When applied at the `output´ value level, it lets you set different values depending on different cases.
Example
In this example, a simple query parameter string is stored in a Variable.
Using a Variable
Once a Variable is created, it will be ready to be used when building Outputs.
Indeed, an existing Variable will show up as a single value from the value components dropdown. Depending on how you want to use it, you may want to add it directly as an output value or you can use it as a single value - as part of a Join, URL, or conditional value.
Either way, to select and add a value:
- Click ´Variables´ from the list > Select the variable you want to use.
- Repeat for each Output field where you want to use the Variable
Hence, a Variable block will be added. Clicking on it will redirect you to the main element under the `Variables´ tab.
Editing a Variable
The main benefit of using a Variable is that you can edit all the instances at once from the main element under the `Variables´ tab.
Simply locate the Variable and edit it as needed.
The changes are automatically saved and applied to all the instances where that Variable is used.
Example
From the GIF, you can see that the same Variable can effortlessly be added to multiple Outputs.
Any change that you make to the Variable, e.g., adding a static value `++´, is also reflected wherever you added it since it is linked.