Hide last authors
Outhman Moustaghfir 1.1 1 = SetVar Connector Documentation =
2
3 == Overview ==
4
Outhman Moustaghfir 3.2 5 [[image:setvar.png]]
6
Outhman Moustaghfir 5.1 7
Outhman Moustaghfir 1.1 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
10 == Usage ==
11
12 === JSON Format ===
13
Outhman Moustaghfir 14.1 14 [[image:var.png]]
Outhman Moustaghfir 3.2 15
Outhman Moustaghfir 14.1 16
Outhman Moustaghfir 1.1 17 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.
18
19 ==== Example 1: ====
20
21 {{{
22 }}}
23
Outhman Moustaghfir 3.3 24 {{code language="json"}}
Outhman Moustaghfir 8.1 25 { "var1": "value1", "var2": "value2" }
Outhman Moustaghfir 1.1 26
27 {{/code}}
28
29
30 ==== Example 2: ====
31
32 {{{
33 }}}
34
Outhman Moustaghfir 3.4 35 {{code language="json"}}
Outhman Moustaghfir 16.1 36 { "var1": "value1", "var2": "{Env.GetVar;variableName}" }
Outhman Moustaghfir 1.1 37 {{/code}}
38
Outhman Moustaghfir 17.1 39 == Global Values ==
Outhman Moustaghfir 1.1 40
Outhman Moustaghfir 17.1 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
Outhman Moustaghfir 1.1 50 === Dynamic Values ===
51
Outhman Moustaghfir 17.1 52 SetVar supports globalvalues using iXPath functions (GetVar, Date, GetTracking...). This allows you to reference the values of other variables within the JSON file.
Outhman Moustaghfir 1.1 53
54 == Examples ==
55
56 === Setting Basic Variables ===
57
58 {{{
59 }}}
60
61 {{code language="json"}}
62 { "username": "john_doe", "email": "john.doe@example.com", "isAdmin": "false" }
63 {{/code}}
64
65
Outhman Moustaghfir 10.1 66 === Using Dynamic Values by GetVar function ===
Outhman Moustaghfir 1.1 67
68
69 {{code language="json"}}
Outhman Moustaghfir 15.1 70 { "username": "john_doe", "email": "{Env.GetVar;Email}", "isAdmin": "false"}
Outhman Moustaghfir 1.1 71 {{/code}}
72
73
74 == Important Notes ==
75
76 * Variables set by SetVar can be referenced within the same JSON file or in subsequent scenarios.
Outhman Moustaghfir 10.1 77 * Ensure proper syntax for dynamic values using **iXPath functions**.
Outhman Moustaghfir 1.1 78
79 == Conclusion ==
80
81 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.
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian