Power Automate Fundamentals # 53: Usage of Union Function in Power Automate

Introduction:

In Power Platform, at times we must combine couple of Arrays or objects. In these scenarios, Union function in Power Automate can be used. As an example, Names String Array and Vehicles String Array were used to explain this behaviour.

Step 1:                                                                                                                            

Login to the required Power Apps environment using URL make.powerapps.com by providing username and password and click on Flows on the left-hand side as shown in the below figure.

Step 2:

After Step 1, Click on New Flow and select instant cloud flow and provide the trigger as Manually trigger a flow and click on Create as shown in the below figure.

Step 3:

After Step 2, name the flow as Union  Function and take a parallel branch and one side of branch take an initialize variable and name it as Names Array and provide values

Name: Names

Type: Array

Value: [“Venkata”,”Polisetty”]

as shown in the below figure.

Step 4:

After Step 3, to the other side of  parallel branch take another initialize variable and name it as Vehicles Array and provide values

Name: Vehicle

Type: Array

Value: [“i10″,”Splendor Pro”]

as shown in the below figure.

Step 5:

After Step 4, now under parallel branchtake a compose action and name it as Combine Names and Vehicles Array and provide the inputs with union  function which Returns a single array or object with all the elements that are in either array or object passed to this function. The parameters for the function can either be a set of objects or a set of arrays (not a mixture thereof). If there are two objects with the same name in the final output, the last object with that name appears in the final object.

union(collection_1: object|array, collection_2: object|array)

as

Inputs : union(variables(‘Names’),variables(‘Vehicle’))

as shown in the below figure.

Step 6:

After Step 5, save and test the flow and observe the results as shown in the below figure.

Note:

  1. Make sure to save and run the flow whenever you try expressions.
  2. Make sure to provide input array in proper acceptable format of string array.
  3. Also use double quotes for the elements in the array.
  4. Parameters that you pass should be of same type either Array or Object only.

Conclusion: In this way we can use Union function in power automate to achieve customer functionality.

2 thoughts on “Power Automate Fundamentals # 53: Usage of Union Function in Power Automate

  1. Pingback: Rewind February 2022 – Common Man Tips for Power Platform, Dynamics CRM,Azure

  2. Pingback: Rewind February 2022 - Microsoft Dynamics CRM Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s