Changes for page SetVar
Last modified by Outhman Moustaghfir on 2024/09/27 13:43
<
>
edited by Outhman Moustaghfir
on 2024/01/30 15:10
on 2024/01/30 15:10
edited by Outhman Moustaghfir
on 2024/01/30 15:01
on 2024/01/30 15:01
Change comment:
Uploaded new attachment "setvar.png", version {1}
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 1 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,9 +2,6 @@ 2 2 3 3 == Overview == 4 4 5 -[[image:setvar.png]] 6 - 7 - 8 8 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. 9 9 10 10 == Usage == ... ... @@ -11,8 +11,6 @@ 11 11 12 12 === JSON Format === 13 13 14 -[[image:Capture d'écran 2024-01-30 150237.png]] 15 - 16 16 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. 17 17 18 18 ==== Example 1: ==== ... ... @@ -20,11 +20,12 @@ 20 20 {{{ 21 21 }}} 22 22 23 -{{code language=" json"}}24 - { "var1": "value1","var2": "true"}18 +{{code language="XML"}} 19 +SetVar(variable_name, value, global=False) 25 25 26 26 {{/code}} 27 27 23 +{ "var1": "value1", "var2": "true" } 28 28 29 29 ==== Example 2: ==== 30 30 ... ... @@ -31,14 +31,16 @@ 31 31 {{{ 32 32 }}} 33 33 34 -{{code language="json"}} 35 -{ "var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } } 30 +{{code language="XML"}} 31 +SetVar(variable_name, value, global=False) 32 + 36 36 {{/code}} 37 37 35 +{ "var1": "value1", "var2": "true", "inputFile1": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } } 38 38 39 39 === Dynamic Values === 40 40 41 -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.39 +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. 42 42 43 43 == Examples == 44 44 ... ... @@ -56,7 +56,7 @@ 56 56 57 57 58 58 {{code language="json"}} 59 -{ " username": "john_doe", "email": "${GetVar;Email}", "isAdmin": "false", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" }}57 +{ "var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } } 60 60 {{/code}} 61 61 62 62 ... ... @@ -63,7 +63,7 @@ 63 63 == Important Notes == 64 64 65 65 * Variables set by SetVar can be referenced within the same JSON file or in subsequent scenarios. 66 -* Ensure proper syntax for dynamic values using **${GetVar;variableName}**.64 +* Ensure proper syntax for dynamic values using ${GetVar;variableName}. 67 67 68 68 == Conclusion == 69 69
- Capture d'écran 2024-01-30 150237.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.omoustaghfir - Size
-
... ... @@ -1,1 +1,0 @@ 1 -14.9 KB - Content