Skip to content

Commit c44d2bc

Browse files
committed
Updates
1 parent d170406 commit c44d2bc

File tree

5 files changed

+67
-19
lines changed

5 files changed

+67
-19
lines changed

articles/logic-apps/create-maps-data-transformation-visual-studio-code.md

Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ After you create your map, you can directly call that map from a workflow in you
2929

3030
This how-to guide shows how to complete the following tasks:
3131

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.
3434
- Navigate the map.
35-
- Add schema elements to the map.
35+
- Select the target and source elements to map.
3636
- Create a direct mapping between elements.
3737
- Create a complex mapping between elements.
3838
- Create a loop between arrays.
@@ -112,8 +112,8 @@ The Data Mapper extension currently works only with schemas in flat folder-struc
112112

113113
The following table describes the possible data types that might appear in a schema:
114114

115-
| Symbol | Type | Notes |
116-
|--------|------|-------|
115+
| Symbol | Type | More info |
116+
|--------|------|-----------|
117117
| ![Icon representing an Array data type.](media/create-maps-data-transformation-visual-studio-code/array-icon.png) | Array | Contains items or repeating item nodes |
118118
| ![Icon representing a Binary data type.](media/create-maps-data-transformation-visual-studio-code/binary-icon.png) | Binary | |
119119
| ![Icon representing a Bool data type.](media/create-maps-data-transformation-visual-studio-code/bool-icon.png) | Bool | True or false only |
@@ -128,7 +128,7 @@ The following table describes the possible data types that might appear in a sch
128128

129129
<a name="navigate-map"></a>
130130

131-
## Navigate the map
131+
## Navigate the map
132132

133133
To move around the map, you have the following options:
134134

@@ -147,7 +147,7 @@ To move around the map, you have the following options:
147147

148148
<a name="select-elements"></a>
149149

150-
## Add elements to the map
150+
## Select target and source elements to map
151151

152152
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.
153153

@@ -163,12 +163,14 @@ To move around the map, you have the following options:
163163

164164
<a name="create-direct-mapping"></a>
165165

166-
## Create a direct mapping between source and target elements
166+
## Create a direct mapping between elements
167167

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:
169169

170170
1. To review what happens in code while you create the mapping, in the map's upper right corner, select **Show code**.
171171

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+
172174
1. Move your pointer over the source element so that both a circle and a plus sign (**+**) appear.
173175

174176
![Screenshot showing the data map and starting a mapping between EmployeeID and ID in the source and target schema, respectively.](media/create-maps-data-transformation-visual-studio-code/direct-mapping-start-source-element.png)
@@ -207,11 +209,13 @@ For a more complex transformation between elements in the source and target sche
207209
| 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 |
208210
| Utility | Copy, Error, Format date-time, Format number |
209211

210-
### Add a function with a single input
212+
### Add a function without a mapping relationship
211213

212214
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.
213215

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).
215219

216220
1. In the map's upper left corner, select **Show functions**.
217221

@@ -252,7 +256,7 @@ The example in this section transforms the source element type from String type
252256

253257
![Screenshot showing code view with direct mapping relationship between source and target elements.](media/create-maps-data-transformation-visual-studio-code/to-date-example-code-view.png)
254258

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).
256260

257261
### Add a function to an existing mapping relationship
258262

@@ -270,7 +274,9 @@ When a mapping relationship already exists between source and target elements, y
270274

271275
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.
272276

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).
274280

275281
1. In the map's upper left corner, select **Show functions**.
276282

@@ -294,23 +300,31 @@ The example in this section concatenates multiple source element types so that y
294300

295301
1. In the function information pane, on the **Properties** tab, under **Inputs**, select the source data elements to use as the inputs.
296302

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.
298304

299305
![Screenshot showing multiple source data elements selected as function inputs.](media/create-maps-data-transformation-visual-studio-code/function-multiple-inputs.png)
300306

301307
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.
302308

303309
![Screenshot showing finished mapping from function with multiple inputs to target element.](media/create-maps-data-transformation-visual-studio-code/function-multiple-inputs-single-output.png)
304310

311+
The code view window reflects the mapping relationship that you created:
312+
313+
![Screenshot showing code view with complex mapping relationship between source and target elements.](media/create-maps-data-transformation-visual-studio-code/concat-example-code-view.png)
314+
305315
<a name="loop-through-array"></a>
306316

307317
## Create a loop between arrays
308318

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).
310324

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.
312326

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.
314328

315329
1. [Create a direct mapping between the source and target elements](#create-direct-mapping).
316330

@@ -324,9 +338,43 @@ If your source and target schemas include arrays, you can create a loop mapping
324338

325339
![Screenshot showing code view with looping relationship between source and target arrays, Employee and Person, respectively.](media/create-maps-data-transformation-visual-studio-code/loop-example-code-view.png)
326340

327-
<a name="create-if-condition"></a>
341+
<a name="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+
![Screenshot showing the data map and elements to map.](media/create-maps-data-transformation-visual-studio-code/if-condition-example-elements.png)
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
375+
376+
![Screenshot showing finished condition example.](media/create-maps-data-transformation-visual-studio-code/if-condition-example-complete.png)
328377

329-
## Create an if condition between items
330378

331379
## Save your map
332380

6 KB
Loading
4.56 KB
Loading
69.9 KB
Loading
44.1 KB
Loading

0 commit comments

Comments
 (0)