SetVar Connector Documentation

Overview

setvar.png

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

Capture d'écran 2024-01-30 150237.png

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:

 
SetVar(variable_name, value, global=False)

{ "var1": "value1", "var2": "true" }

Example 2:

 
SetVar(variable_name, value, global=False)

{ "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

 
{ "username": "john_doe", "email": "john.doe@example.com", "isAdmin": "false" }

Using Dynamic Values

{ "var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }

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.

Tags:
Created by Outhman Moustaghfir on 2024/01/30 14:57
    
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian