<
From version < 3.3 >
edited by Outhman Moustaghfir
on 2024/01/30 15:03
To version < 18.1 >
edited by Outhman Moustaghfir
on 2024/09/27 13:39
>
Change comment: Uploaded new attachment "1727437198067-371.png", version {1}

Summary

Details

Page properties
Content
... ... @@ -4,6 +4,7 @@
4 4  
5 5  [[image:setvar.png]]
6 6  
7 +
7 7  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.
8 8  
9 9  == Usage ==
... ... @@ -10,8 +10,9 @@
10 10  
11 11  === JSON Format ===
12 12  
13 -[[image:Capture d'écran 2024-01-30 150237.png]]
14 +[[image:var.png]]
14 14  
16 +
15 15  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.
16 16  
17 17  ==== Example 1: ====
... ... @@ -20,7 +20,7 @@
20 20   }}}
21 21  
22 22  {{code language="json"}}
23 -{ "var1": "value1", "var2": "true" }
25 +{ "var1": "value1", "var2": "value2" }
24 24  
25 25  {{/code}}
26 26  
... ... @@ -30,16 +30,24 @@
30 30  {{{
31 31   }}}
32 32  
33 -{{code language="XML"}}
34 -SetVar(variable_name, value, global=False)
35 -
35 +{{code language="json"}}
36 +{ "var1": "value1", "var2": "{Env.GetVar;variableName}" }
36 36  {{/code}}
37 37  
38 -{ "var1": "value1", "var2": "true", "inputFile1": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }
39 +== Global Values ==
39 39  
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 +
40 40  === Dynamic Values ===
41 41  
42 -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.
52 +SetVar supports globalvalues using iXPath functions (GetVar, Date, GetTracking...). This allows you to reference the values of other variables within the JSON file.
43 43  
44 44  == Examples ==
45 45  
... ... @@ -53,11 +53,11 @@
53 53  {{/code}}
54 54  
55 55  
56 -=== Using Dynamic Values ===
66 +=== Using Dynamic Values by GetVar function ===
57 57  
58 58  
59 59  {{code language="json"}}
60 -{ "var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }
70 +{ "username": "john_doe", "email": "{Env.GetVar;Email}", "isAdmin": "false"}
61 61  {{/code}}
62 62  
63 63  
... ... @@ -64,7 +64,7 @@
64 64  == Important Notes ==
65 65  
66 66  * Variables set by SetVar can be referenced within the same JSON file or in subsequent scenarios.
67 -* Ensure proper syntax for dynamic values using ${GetVar;variableName}.
77 +* Ensure proper syntax for dynamic values using **iXPath functions**.
68 68  
69 69  == Conclusion ==
70 70  
1727437198067-371.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.omoustaghfir
Size
... ... @@ -1,0 +1,1 @@
1 +34.5 KB
Content
var.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.omoustaghfir
Size
... ... @@ -1,0 +1,1 @@
1 +14.3 KB
Content
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian