Last modified by Erik Bakker on 2023/01/24 15:10

From version 16.1
edited by Erik Bakker
on 2022/06/10 08:38
Change comment: Imported from XAR
To version 17.1
edited by Erik Bakker
on 2022/06/10 08:38
Change comment: Imported from XAR

Summary

Details

Page properties
Content
... ... @@ -1,11 +1,4 @@
1 -{{html wiki="true"}}
2 -<div class="ez-academy">
3 - <div class="ez-academy_body">
4 -
5 -<div class="doc">
6 -
7 -
8 -
1 +{{container}}{{container layoutStyle="columns"}}(((
9 9  = Transformation * XPath Basic =
10 10  
11 11  Sometimes the transformation tooling does not provide you with the exact correct transformation option to get the desired result in your output.
... ... @@ -14,7 +14,7 @@
14 14  In this microlearning, we will educate you on the basics of XPath and see how we can use it **within** the context of transforming messages.
15 15  In other microlearnings, we will discuss the use of XPath **outside** the context of transforming messages.
16 16  
17 -Should you have any questions, please contact academy@emagiz.com.
10 +Should you have any questions, please contact [[academy@emagiz.com>>mailto:academy@emagiz.com]].
18 18  
19 19  * Last update: November 8th, 2021
20 20  * Required reading time: 9 minutes
... ... @@ -51,7 +51,7 @@
51 51  
52 52  For example, take a look at the following **input** message:
53 53  
54 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--basic-input-message.png||]]</p>
47 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--basic-input-message.png]]
55 55  
56 56  When I want to write a "path" to Projects I would only have to write down / and that is it. However, when I want to write a "path" to Project I have two options.
57 57  I can either start at the root (Absolute XPath) and navigate down from there which would give me /Projects/Project as a valid XPath expression.
... ... @@ -66,7 +66,7 @@
66 66  
67 67  At this point you probably wonder why anyone would start their journey on the XPath "path" from the root level. Well imagine the following **input** message:
68 68  
69 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--second-basic-input-message.png||]]</p>
62 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--second-basic-input-message.png]]
70 70  
71 71  As you can see from this example taking the third option of our previous example would end up getting two results (both the ID under Project and the ID under Status).
72 72  There are also scenarios one could think of that would benefit from starting **not** on the root level of the **input** message. So always consider the context when writing down your XPath.
... ... @@ -106,7 +106,7 @@
106 106  By defining the prefix of the namespace (i.e. sys, cdm, ns) you can refer to this prefix while reading and writing your XPath.
107 107  Let's return to our original example, only this time the **input** message has a namespace:
108 108  
109 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--namespace-input-message.png||]]</p>
102 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--namespace-input-message.png]]
110 110  
111 111  As you can see the notation has slightly changed. A prefix has occurred before each element and attributes called sys. To separate the prefix from the name of the element or attribute a colon (:) is used.
112 112  The XPath also needs to change to get the desired result. We need to take the prefix into account. This will result in the following valid XPath options:
... ... @@ -123,7 +123,7 @@
123 123  
124 124  Using the wildcard will result in the following valid XPath options:
125 125  
126 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--wildcard-xpath.png||]]</p>
119 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--wildcard-xpath.png]]
127 127  
128 128  === 3.5 Custom XPath in Transformation ===
129 129  
... ... @@ -135,7 +135,7 @@
135 135  
136 136  Let us look at a example in eMagiz:
137 137  
138 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath.png||]]</p>
131 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath.png]]
139 139  
140 140  In this example, you see two notes on two attributes. One on the DateTime on Order Level and one on the Description on OrderLine level. The requirements are:
141 141  
... ... @@ -154,7 +154,7 @@
154 154  To ensure that we only place the DateTime value of the first OrderLine in the DateTime field on Order level in the **output** message we need to change the XPath.
155 155  To do so enter Start Editing Mode and navigate to the Transformation. In here select the option Transformation and then Custom XPath
156 156  
157 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath-pop-up.png||]]</p>
150 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath-pop-up.png]]
158 158  
159 159  In here we need to ensure that we only take the DateTime value from the **first** OrderLine. To do so we need to specify which of the OrderLines we want as input.
160 160  You can specify that by using the following notation:
... ... @@ -165,7 +165,7 @@
165 165  
166 166  This would change our XPath to OrderLine[1]/DateTime. So let us fill that in and press Save.
167 167  
168 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath-pop-up-filled-in.png||]]</p>
161 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath-pop-up-filled-in.png]]
169 169  
170 170  Now let us turn our focus toward the second part of this example. Remember what we said earlier.
171 171  The starting point of your "path" within a transformation is determined by the starting point of the line that is drawn to the entity you are currently working with.
... ... @@ -183,14 +183,14 @@
183 183  
184 184  This would change our XPath to string-join((DateTime, ID),'-'). So let us fill that in and press Save.
185 185  
186 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath-pop-up-filled-in-string-join.png||]]</p>
179 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-xpath-pop-up-filled-in-string-join.png]]
187 187  
188 188  When I tested this I got the following result. In a later microlearning, we will teach you all about testing these things yourself.
189 189  
190 -<p align="center">[[image:crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-custom-xpath-result.png||]]</p>
183 +[[image:Main.Images.Microlearning.WebHome@crashcourse-platform-create-transformation-xpath-basic--emagiz-transformation-custom-xpath-result.png]]
191 191  
192 -===== Practice =====
193 193  
186 +
194 194  == 4. Assignment ==
195 195  
196 196  Open a flow that makes use of the transformation tooling and enters two custom XPath expression to achieve the following:
... ... @@ -222,11 +222,6 @@
222 222  
223 223  This video demonstrates a working solution and how you can validate whether you have successfully completed the assignment.
224 224  
225 -<iframe width="1280" height="720" src="../../vid/microlearning/crashcourse-platform-create-transformation-xpath-basic.mp4" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
218 +{{video attachment="crashcourse-platform-create-transformation-xpath-basic.mp4" reference="Main.Videos.Microlearning.WebHome"/}}
226 226  
227 -</div>
228 -
229 -</div>
230 -</div>
231 -
232 -{{/html}}
220 +)))((({{toc/}}))){{/container}}{{/container}}