Use flow controls to perform data operations – Demonstrate the capabilities of Power Automate

Use flow controls to perform data operations

When working with data from various sources, it is sometimes necessary to modify the data format to make the sources compatible. Power Automate’s Data Operation actions makes it possible to reuse and reformat the data from previous actions in various ways:

■ Compose—Allows the developer to type a data string into the Inputs field, as shown in Figure 5-40, and reuse that string later. In a subsequent action, the developer can select the Outputs field from the Compose section in the Dynamic content pop-up to insert the string from the Inputs field in the Compose action.

FIGURE 5-40 The Compose action in the Power Automate workspace canvas

■ Create CSV table—Allows the developer to convert a data array into a table in CSV (comma-separated values) format, as shown in Figure 5-41. In this example, the array of usernames taken from the body of the previous action will be reformatted into the following table:

FIGURE 5-41 The Create CSV table action in the Power Automate workspace canvas

Click here to view code image

FirstName,LastName
Sanjay,Patel
Joanna,Yuan

■ Create HTML table—Allows the developer to convert a data array into an HTML (Hypertext Markup Language) table.

■ Filter array—Allows the developer to apply a filter to a data array using an equation to select specific entries, as shown in Figure 5-42. In this example, an array consisting of usernames will be filtered to include only those users with a last name of Patel.

FIGURE 5-42 The Filter array action in the Power Automate workspace canvas

■ Join—Allows the developer to modify a data array to use a different delimiter, as shown in Figure 5-43. In this example, the array of addresses in the From field is delimited by commas. Specifying a semicolon in the Join with field ensures that the resulting output will be the same array but delimited with semicolons.

FIGURE 5-43 The Join action in the Power Automate workspace canvas

■ Parse JSON—Allows the developer to interpret the JSON output from a previous action by specifying a sample schema, as shown in Figure 5-44. The developer can then use the Dynamic content pop-up for a following action to select specific Parse JSON fields derived from the sample schema.

FIGURE 5-44 The Parse JSON action in the Power Automate workspace canvas

■ Select—Allows the developer to reshape a data array to suit a different application or service, as shown in Figure 5-45. In this example, an array of names using the labels first and last, such as [ { “first”: “Sanjay”, “last”: “Patel” }, { “first”: “Joanna”, “last”: “Yuan” } ], will be remapped to use the labels FirstName and LastName instead, as in [ { “FirstName”: “Sanjay”, “LastName”: “Patel” }, { “FirstName”: “Joanna”, “LastName”: “Yuan” } ].

FIGURE 5-45 The Select action in the Power Automate workspace canvas

Leave a Reply

Your email address will not be published. Required fields are marked *