MEP Expression Language
Create Dynamic Variable Names
A variable can reference the value of another existing variable. In an expression, this requires square brackets:
${scope[variable]}
For example, to create a service variable that updates to a new name every day, you could use the Variables > Set handler to create a variable with:
- service as the scope
- ${system.date} as the key
- 1 as the default (or initial) value
- ${service[system.date] + 1} as the value
The value ${service[system.date]} counts the number of times the handler was triggered. Each day, a new variable would be generated, and you would then see each day’s variable with its own value; for example:
Variable |
Description |
---|---|
service.2010-10-21 |
1478 |
service.2010-10-20 |
2231 |
service.2010-10-19 |
796 |
If you wanted to reference this variable in a handler, you would use the format:
${service[system.date]}