You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/logic-apps/create-maps-data-transformation-visual-studio-code.md
+67-19Lines changed: 67 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,10 @@ After you create your map, you can directly call that map from a workflow in you
29
29
30
30
This how-to guide shows how to complete the following tasks:
31
31
32
-
- Create a new data map.
33
-
- Specify the source and target schemas to use for the map.
32
+
- Create a blank data map.
33
+
- Specify the source and target schemas to use.
34
34
- Navigate the map.
35
-
-Add schema elements to the map.
35
+
-Select the target and source elements to map.
36
36
- Create a direct mapping between elements.
37
37
- Create a complex mapping between elements.
38
38
- Create a loop between arrays.
@@ -112,8 +112,8 @@ The Data Mapper extension currently works only with schemas in flat folder-struc
112
112
113
113
The following table describes the possible data types that might appear in a schema:
114
114
115
-
| Symbol | Type |Notes|
116
-
|--------|------|-------|
115
+
| Symbol | Type |More info|
116
+
|--------|------|-----------|
117
117
|| Array | Contains items or repeating item nodes |
118
118
|| Binary ||
119
119
|| Bool | True or false only |
@@ -128,7 +128,7 @@ The following table describes the possible data types that might appear in a sch
128
128
129
129
<aname="navigate-map"></a>
130
130
131
-
## Navigate the map
131
+
## Navigate the map
132
132
133
133
To move around the map, you have the following options:
134
134
@@ -147,7 +147,7 @@ To move around the map, you have the following options:
147
147
148
148
<aname="select-elements"></a>
149
149
150
-
## Add elements to the map
150
+
## Select target and source elements to map
151
151
152
152
1. On the map surface, from the target schema's data element list, select the target element that you want to map. If that element is a child of a parent element, find and expand the parent first.
153
153
@@ -163,12 +163,14 @@ To move around the map, you have the following options:
163
163
164
164
<aname="create-direct-mapping"></a>
165
165
166
-
## Create a direct mapping between source and target elements
166
+
## Create a direct mapping between elements
167
167
168
-
For a straightforward transformation between elements with the same type in the source and targe schemas, follow these steps:
168
+
For a straightforward transformation between elements with the same type in the source and target schemas, follow these steps:
169
169
170
170
1. To review what happens in code while you create the mapping, in the map's upper right corner, select **Show code**.
171
171
172
+
1. If you haven't already, on the map, [select the target elements and then the source elements that you want to map](#select-elements).
173
+
172
174
1. Move your pointer over the source element so that both a circle and a plus sign (**+**) appear.
173
175
174
176

@@ -207,11 +209,13 @@ For a more complex transformation between elements in the source and target sche
207
209
| String | Code points to string, Concat, Contains, Ends with, Length, Lowercase, Name, Regular expression matches, Regular expression replace, Replace, Starts with, String to code-points, Substring, Substring after, Substring before, Trim, Trim left, Trim right, Uppercase |
208
210
| Utility | Copy, Error, Format date-time, Format number |
209
211
210
-
### Add a function with a single input
212
+
### Add a function without a mapping relationship
211
213
212
214
The example in this section transforms the source element type from String type to DateTime type, which matches the target element type. The example uses the **To date** function, which takes a single input.
213
215
214
-
1. Make sure that map shows the source and target elements that you want.
216
+
1. To review what happens in code while you create the mapping, in the map's upper right corner, select **Show code**.
217
+
218
+
1. If you haven't already, on the map, [select the target elements and then the source elements that you want to map](#select-elements).
215
219
216
220
1. In the map's upper left corner, select **Show functions**.
217
221
@@ -252,7 +256,7 @@ The example in this section transforms the source element type from String type
252
256
253
257

254
258
255
-
For example, to iterate through array items, see [Create a loop between arrays](#loop-through-array). To perform a task when an element's value meets a condition, see [Create an if condition between items](#create-if-condition).
259
+
For example, to iterate through array items, see [Create a loop between arrays](#loop-through-array). To perform a task when an element's value meets a condition, see [Add a condition between elements](#add-condition).
256
260
257
261
### Add a function to an existing mapping relationship
258
262
@@ -270,7 +274,9 @@ When a mapping relationship already exists between source and target elements, y
270
274
271
275
The example in this section concatenates multiple source element types so that you can map the results to the target element type. The example uses the **Concat** function, which takes multiple inputs.
272
276
273
-
1. Make sure that map shows the source and target elements that you want.
277
+
1. To review what happens in code while you create the mapping, in the map's upper right corner, select **Show code**.
278
+
279
+
1. If you haven't already, on the map, [select the target elements and then the source elements that you want to map](#select-elements).
274
280
275
281
1. In the map's upper left corner, select **Show functions**.
276
282
@@ -294,23 +300,31 @@ The example in this section concatenates multiple source element types so that y
294
300
295
301
1. In the function information pane, on the **Properties** tab, under **Inputs**, select the source data elements to use as the inputs.
296
302
297
-
This example selects the **FirstName** and **LastName** source elements as the function inputs, which automatically adds the connections on the map.
303
+
This example selects the **FirstName** and **LastName** source elements as the function inputs, which automatically add the respective connections on the map.
298
304
299
305

300
306
301
307
1. To complete the mapping drag and draw a line between the function's right edge and the target element. You can start either from the target element or from the function.
302
308
303
309

304
310
311
+
The code view window reflects the mapping relationship that you created:
312
+
313
+

314
+
305
315
<aname="loop-through-array"></a>
306
316
307
317
## Create a loop between arrays
308
318
309
-
If your source and target schemas include arrays, you can create a loop mapping that iterates through the items in those arrays.
319
+
If your source and target schemas include arrays, you can create a loop mapping relationship that iterates through the items in those arrays. The example in this section loops through an Employee source array and a Person target array.
320
+
321
+
1. To review what happens in code while you create the mapping, in the map's upper right corner, select **Show code**.
322
+
323
+
1. On the map, in the target schema area, [select the target array element and target array item elements that you want to map](#select-elements).
310
324
311
-
1. On the map, in the target schema area, expand the array and array items.
325
+
1. On the map, in the target schema area, expand the target array element and array items.
312
326
313
-
1. In the source schema area, add the array source element and array item elements to the map.
327
+
1. In the source schema area, add the source array element and array item elements to the map.
314
328
315
329
1.[Create a direct mapping between the source and target elements](#create-direct-mapping).
316
330
@@ -324,9 +338,43 @@ If your source and target schemas include arrays, you can create a loop mapping
324
338
325
339

326
340
327
-
<aname="create-if-condition"></a>
341
+
<aname="add-condition"></a>
342
+
343
+
## Set up a condition and task to perform between elements
344
+
345
+
To add a mapping relationship that evaluates a condition and performs a task when the condition is met, you can use multiple functions, such as the **If** function, a comparison function such as **Greater**, and the task to perform such as **Multiply**.
346
+
347
+
The example in this section calculates a discount to apply when the purchase quantity exceeds 20 items by using the following functions:
348
+
349
+
-**Greater**: Check whether item quantity is greater than 20
350
+
-**If**: Check whether the **Greater** function returns true.
351
+
-**Multiply**: Calculate the discount by multiplying the item price by 10% and the item quantity.
352
+
353
+
1. To review what happens in code while you create the mapping, in the map's upper right corner, select **Show code**.
354
+
355
+
1. If you haven't already, on the map, [select the target elements and then the source elements that you want to map](#select-elements).
356
+
357
+
This example selects the following elements:
358
+
359
+

360
+
361
+
1. In the map's upper left corner, select **Show functions**.
362
+
363
+
1. Add the following functions to the map: **Greater**, **If**, and **Multiply**
364
+
365
+
1. Expand all the function shapes to show the function details and connection points.
366
+
367
+
1. Connect the source elements, functions, and target elements as follows:
368
+
369
+
* The source schema's **ItemPrice** element to the target schema's **ItemPrice** element
370
+
* The source schema's **ItemQuantity** element to the **Greater** function's **Value** field
371
+
* The **Greater** function's output to the **If** function's **Condition** field
372
+
* The **If** function's output to the target schema's **ItemDiscount** element
373
+
* The source schema's **ItemPrice** element to the **Multiply** function's **Multiplicand 0*** field
374
+
* The **Multiply** function's output to the **If** function's **Value** field
0 commit comments