In this article

Use data operations with Microsoft Flow

08/02/2017

5 minutes to read

Contributors

In this article

In this walkthrough, you learn about some of the Microsoft Flow’s popular data operations, such as compose, join, select, filter array, create table, and parse JSON that are available to manipulate data when you create flows.

Prerequisites

Access to Microsoft Flow.

A tool such as PostMan to send HTTP POST requests with a JSON array to your flow.

Use the compose action

Use the Data Operations - Compose (compose) action to save yourself from entering identical data multiple times when you’re designing a flow. For example, if you need to enter an array of digits: [0,1,2,3,4,5,6,7,8,9] several times while you design your flow, you could use the compose action to save the array like this:

Search for Compose, and then select the Data Operations - Compose (compose) action.

Enter the array into the Inputs box you want to reference later:

Tip

For easier reference later, rename the Compose card by clicking on the text "Compose" on the title bar of the Compose card.

When you need to access the contents of the compose action, do so via the Output token on the Add dynamic content from the apps and connectors used in this flow list by following these steps:

Add an action such as Data Operations – Join.

Select the control to which you’d like to add the contents you saved in the compose action.

The Add dynamic content from the apps and connectors used in this flow opens.

On the Add dynamic content from the apps and connectors used in this flow, select the Output token that’s under the Compose category of the Dynamic content tab.

Use the join action

Use the Data Operations - Join action (Join) to delimit an array with a separator of your choice. For example, assume your flow receives a web request that includes the following array of email addresses: ["d@example.com", "k@example.com", "dal@example.com"]. However, your email program requires addresses to be a single string that's separated with semicolons. To do this, use the Data Operations - Join (join) action to change the comma delimiter to a semicolon “;“ by following these steps:

Add a new action, search for Join, and then select Data Operations - Join (join).

Enter the array into the From box, and then enter the new delimiter that you want to use into the Join with box.

Here, I’ve used the semicolon (;) as the new delimiter.

Save your flow, and then run it.

After your flow runs, the output of the Data Operations – Join action will be:

Use the select action

Use the Data Operations – Select (select) to transform the shape of the objects in an array. For example, you may add, remove, or rename elements in each object in an array.

Note

While you can add or remove elements using the select action, you cannot change the number of objects in the array.

For example, you can use the select action if data enters your flow via a web request in this format:

and you’d like to reshape the incoming data by renaming "first" to "FirstName", "last" to "LastName" and adding a new member named "FamilyName" that combines "first" and "last" (separated with a space):

the output looks like this array (notice that only objects in which first is set to “Deon” are included in the output of the action):

[ { "first": "Deon", "last": "Herb" } ]

Use the create csv table action

Use the Data Operations - Create CSV table (create csv table) to change a JSON array input into a comma separated value (CSV) table. Optionally, you can keep the headers visible in the CSV output. For example, you can convert the following array into a CSV table by using the Create CSV table action:

Find, add, and then configure the Data Operations - Create CSV table action to resemble the following image.

Note: The Body token in this image comes from a Request / Response – Response action, however, you could get the input for the Create CSV table action from the output of any previous action in your flow, or you can enter it directly into the From box.

Save, and then run your flow.

When your flow runs, the Create CSV table output looks like this image:

Use the create html table action

Use Data Operations - Create HTML table to change a JSON array input into an HTML table. Optionally, you can keep the headers visible in the HTML output.

To do this, follow the steps in the create csv table section for a detailed example. Be sure to use the Data Operations - Create HTML table action, instead of the Data Operations - Create CSV table action.

Tip

If you plan to send the HTML table via email, remember to select "IsHtml" in the email action.

Feedback

We'd love to hear your thoughts. Choose the type you'd like to provide: