SetVar
SetVar Connector Documentation
Overview
The SetVar connector is designed to set variables within a scenario by utilizing a JSON file. This connector allows users to define variables and even use dynamic values using expressions.
Usage
JSON Format
The JSON file for SetVar has a simple structure. It consists of key-value pairs, where the keys represent variable names, and the values can be either static values or dynamic expressions.
Example 1:
{ "var1": "value1", "var2": "true" }
Example 2:
{ "var1": "value1", "var2": "true", "inputFile1": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }
Dynamic Values
SetVar supports dynamic values using expressions in the ${GetVar;variableName} format. This allows you to reference the values of other variables within the JSON file.
Examples
Setting Basic Variables
Using Dynamic Values
Important Notes
- Variables set by SetVar can be referenced within the same JSON file or in subsequent scenarios.
- Ensure proper syntax for dynamic values using ${GetVar;variableName}.
Conclusion
The SetVar connector simplifies the process of setting and managing variables within your scenarios. By providing both static and dynamic values, it offers flexibility and enhances the reusability of variable values across different parts of your workflow.