Changes for page SetVar
Last modified by Outhman Moustaghfir on 2024/09/27 13:43
<
>
edited by Outhman Moustaghfir
on 2024/01/30 15:01
on 2024/01/30 15:01
edited by Outhman Moustaghfir
on 2024/03/11 17:14
on 2024/03/11 17:14
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,6 +2,9 @@ 2 2 3 3 == Overview == 4 4 5 +[[image:setvar.png]] 6 + 7 + 5 5 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. 6 6 7 7 == Usage == ... ... @@ -8,6 +8,9 @@ 8 8 9 9 === JSON Format === 10 10 14 +[[image:var.png]] 15 + 16 + 11 11 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. 12 12 13 13 ==== Example 1: ==== ... ... @@ -15,12 +15,11 @@ 15 15 {{{ 16 16 }}} 17 17 18 -{{code language=" XML"}}19 - SetVar(variable_name,value,global=False)24 +{{code language="json"}} 25 +{ "var1": "value1", "var2": "value2" } 20 20 21 21 {{/code}} 22 22 23 -{ "var1": "value1", "var2": "true" } 24 24 25 25 ==== Example 2: ==== 26 26 ... ... @@ -27,16 +27,24 @@ 27 27 {{{ 28 28 }}} 29 29 30 -{{code language="XML"}} 31 -SetVar(variable_name, value, global=False) 32 - 35 +{{code language="json"}} 36 +{ "var1": "value1", "var2": "{Env.GetVar;variableName}" } 33 33 {{/code}} 34 34 35 - {"var1": "value1", "var2": "true", "inputFile1":"${GetVar;inputFile}", "nestedVar":{ "nestedVar1": "val1", "nestedVar2": "val2" } }39 +== Global Values == 36 36 41 +SetVar supports dynamic values using XGlobal before the variable name to make this var accessibel in the parent sceanrio . 42 + 43 +== Examples == 44 + 45 + 46 +{{code language="json"}} 47 +{ "iXGlobal:Key": "Value" } 48 +{{/code}} 49 + 37 37 === Dynamic Values === 38 38 39 -SetVar supports dynamicvalues usingexpressionsin the ${GetVar;variableName}format. This allows you to reference the values of other variables within the JSON file.52 +SetVar supports globalvalues using iXPath functions (GetVar, Date, GetTracking...). This allows you to reference the values of other variables within the JSON file. 40 40 41 41 == Examples == 42 42 ... ... @@ -50,11 +50,11 @@ 50 50 {{/code}} 51 51 52 52 53 -=== Using Dynamic Values === 66 +=== Using Dynamic Values by GetVar function === 54 54 55 55 56 56 {{code language="json"}} 57 -{ " var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2"}}70 +{ "username": "john_doe", "email": "{Env.GetVar;Email}", "isAdmin": "false"} 58 58 {{/code}} 59 59 60 60 ... ... @@ -61,7 +61,7 @@ 61 61 == Important Notes == 62 62 63 63 * Variables set by SetVar can be referenced within the same JSON file or in subsequent scenarios. 64 -* Ensure proper syntax for dynamic values using ${GetVar;variableName}.77 +* Ensure proper syntax for dynamic values using **iXPath functions**. 65 65 66 66 == Conclusion == 67 67
- Capture d'écran 2024-01-30 150237.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.omoustaghfir - Size
-
... ... @@ -1,0 +1,1 @@ 1 +14.9 KB - Content
- var.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.omoustaghfir - Size
-
... ... @@ -1,0 +1,1 @@ 1 +14.3 KB - Content