Power Automate Array Variable + 15 Examples

In this Power automate tutorial, we will learn about power automate array variable. And also we will discuss the below points:

  • Power automate array variable apply to each
  • Power automate array variable to string
  • Power automate array variable index
  • Power automate create array variable
  • Power automate variable array of objects
  • Power automate append array variable
  • Power automate add array variable
  • Power automate append to array variable json
  • Power automate filter array variable
  • Power automate remove duplicates from array variable
  • Power automate email array variable
  • Power automate get array variable
  • Power automate get item from array variable
  • Power automate get first item in array variable
  • Power automate length of array variable

Power Automate array variable apply to each

Here we will see how to loop the array using applying it to each item in an array in the Power Automate.

So here we will create a list of arrays in power automate and then add apply to each control action to loop through the array. At last, store the list of items from an array to the SharePoint list.

So here I have created a Technology list in SharePoint having one column where we will store the Technology name. like below:

power automate apply to each item in array variable
power automate apply to each item in array variable

Next in Power Automate, create a Manually triggered Flow. Then click on the Next step.

power automate apply to each item in array variable
power automate apply to each item in array variable

Select the Initialize variable, and set the variable name, type as an array, and set the value like the below array.

power automate apply to each item in array variable
power automate apply to each item in array variable

Now we will loop through each item in an array using Apply to each loop. So, click on the Next step, and select Apply to each action. Then in the value set the varArray from the dynamic content.

microsoft flow apply to each current item value
Microsoft flow apply to each current item value

Now we will create the array of items in the SharePoint list, so click on the Add an action inside the loop and select Create item.

Then provide the site address, list name, and in title select the current item of the Apply to each from the dynamic content.

power automate apply to each item in array variable
power automate apply to each item in array variable

Next, click on Save and run the Flow manually, once your flow ran successfully

power automate array variable apply to each
power automate array variable apply to each

After the flow ran successfully, go to the SharePoint list, you can see loop control create an item from the array to the list.

power automate for each array variable
power automate for each array variable

This is an example of a Power Automate array variable apply to each.

  • Convert SharePoint document to PDF using Power Automate

Power automate array variable to string

Here we will see how to convert array variables to string using Microsoft Flow.

We will use the Join action in Power automate to convert the array into strings.

In Power Automate, select the Manually triggered Flow, and then click on Next step.

power automate array variable to string
power automate array variable to string

Select the Initialize variable action, then set the variable name, type as an array, and set the values like below array

power automate array variable to string
power automate array variable to string

Now we will convert the array into a string, so click on the Next step and select Join action from the data operation. In the From field set the varArray from the dynamic content, and then in Join with box set the comma ‘,’.

power automate array variable to string
power automate array variable to string

Next, click on Save and run the flow manually, we can see the result in the join output.

power automate array variable to string
power automate array variable to string

This is an example of the Power automate array variable to string.

Power automate array variable index

Here we will see how to access elements by index value from the array variable in Microsoft Flow.

For example, we have a list such as [“SharePoint”, “Power Automate”, “Power Apps”]. So in the array, the index value starts from 0, to get the value Power Automate we can write varArray[1].

So, In the Power Automate, create a Manually triggered Flow. Then click on the Next step.

power automate array variable index
power automate array variable index

Select the Initialize variable, and then set the variable name, type as an array, and set the value like below.

power automate array variable index
power automate array variable index

Then click on Next step and select Compose action. Then in Input add the below expression:

variables('varArray')[1]
power automate array variable index
power automate array variable index

Now click on Save and run the flow manually, you can see the result in the compose output.

power automate for each array variable
power automate for each array variable

This is a quick example of a Power Automate array variable index.

  • Convert Email to PDF using Microsoft flow or Power Automate
See also  Create a SharePoint Online Communication Site using Power Automate [Download Complete Package]

Power automate create array variable

Here we will see how to use the createArray function to create the array in Power Automate.

In Power automate, click on Manually triggered Flow. Then click on the Next step.

power automate create array variable
power automate create array variable

Select Initialize variable action, and then set the variable name, type as Array, and value like below.

power automate create array variable
power automate create array variable

Now we will create an array with the provided array using the createArray function in Power automate. And createArray function always creates a new array even if we provide an array as one of the objects.

Click on the Next step and then select Compose action. In the input write the below expression:

createArray(variables('varArray'),'Power Bi')
power automate compose array variable
power automate compose array variable

Now click on Save and run the Flow manually. We can see the result in the compose output.

power automate array variable to json
power automate array variable to json

This is how to create array variable in Power Automate.

  • Saving microphone audio recorded in PowerApps to SharePoint online

Power automate variable array of objects

Here we will see how to compare an array of objects based on array item property using Power Automate.

Here we will create an array, where each item in the array has an object with its properties. We will compare the two arrays of objects and then filter the common objects.

So, In the Power automate select the manually triggered flow. Then click on the Next step.

power automate variable array of objects
power automate variable array of objects

Select the Initialize variable action, and then set the variable name and type as an array and set the value like below.

Similarly, initialize another variable of type array and set the value.

power automate variable array of objects
power automate variable array of objects

Now we will compare the two arrays of objects using the intersection function to get the common object.

So click on the Next step and select compose action. and in input write the below expression:

intersection(variables('varArray1'),variables('varArray2'))
power automate variable array of objects
power automate variable array of objects

Now click on Save and run the flow manually, we can see the result in the compose output.

power automate variable array of objects
power automate variable array of objects

This is an example of Power automate variable array of objects.

  • Microsoft Flow or PowerAutomate: Trigger email based on user input

Power automate append array variable

Here we will see how to append value in the array variable using Microsoft Flow.

Now we will create a flow in which we will create an array and then we will append the value at the end of the array using Microsoft Flow.

In the Power Automate, create a Manually triggered Flow. Then click on the Next step.

power automate append array variable
power automate append array variable

Select Initialize variable action, then set the variable name, type as an array, and set the value like below.

power automate append array variable
power automate append array variable

To append a value to the array, click on the Next step and then select the ‘Append to array variable‘ action. Then in the variable name select the variable from the dropdown and then add the value.

power automate append array variable
power automate append array variable

Next, to see the result we will use the compose, so click on the next step and select the Compose action, then in the input box set the varArray1 from the dynamic content.

power automate append array variable
power automate append array variable

Now click on Save and run the Flow manually, we can see the result in the compose output.

power automate append array variable
power automate append array variable

This is how to append an array variable in Power Automate.

  • Get a push notification when a new file is added to OneDrive for Business

Power automate add array variable

Here we will see how to add properties to the array variable using Microsoft Flow.

So we will fetch a list of items from the SharePoint list called Technology, then we will add a property to the array of items using Microsoft Flow.

 power automate add array variable
power automate add array variable

So, in the Power Automate, create a manually triggered Flow. And click on the Next step.

 power automate access array variable
power automate access array variable

Now we will fetch the list of items from the Technology list in SharePoint. So, select the Get items action. Then Provide the site address and list name.

power automate create array variable
power automate create array variable

Now we will create a compose action that will take input of a list of items, later we will use it as an array.

So, click on the Next step, and then select compose action. In input add the value of get items from the dynamic content.

power automate compose array variable
power automate compose array variable

Now click on the Next step, and then select initialize variable action. Then set the variable name, type as an array, and in value add the output of the compose.

power automate add array variable
power automate add array variable

Next, we will create an Apply to each that will loop through each item in the array we have initialized.

So click on the Next step, and then select Apply to each action. In the value set the array, like the below screenshot.

power automate add array variable
power automate add array variable

Now we will add property value to the array, so click on the Next step and then select the compose action. In input add the below expression:

addProperty(item(),'Company', 'Test')
power automate add array variable
power automate add array variable

Now run the flow manually, and you can see the property value pair at the end of the array.

power automate add array variable
power automate add array variable

This is how to add array variable in Power Automate.

  • Save Twitter Tweets in SharePoint Online list using Microsoft Flow
See also  How to create a custom calendar in PowerApps

Power automate append to array variable JSON

Here we will see how to append to array variable JSON using Microsoft Flow.

So, we will create a flow in which we will append an array to the array of objects.

Now in the Power Automate select the Manually triggered Flow. Then click on the Next step.

microsoft flow append to array variable json
Microsoft flow append to array variable json

Select the Initialize variable action, then set the variable name, type as an array, and set the value like below:

microsoft flow append to array variable json
Microsoft flow append to array variable json

Now we will append the array to the array variable. So click on the next step and select Append to array variable action.

Then choose the variable name from the dropdown, and in value write the array like below:

microsoft flow append to array variable json
Microsoft flow append to array variable json

Next, we will create a compose action to see the result, so click on the next step and select compose action. Then in input add the varArray from the dynamic content.

power automate append to array variable json
power automate append to array variable json

Now click on Save and run the Flow manually. Now we can see the result in the compose output.

power automate append to array variable enter a valid json
power automate append to array variable enter a valid json

Check out, Microsoft flow examples: Save Office 365 email attachments to OneDrive for Business

Power automate filter array variable

Here we will see how to filter items from the array in Microsoft Flow.

To filter an Array we will use the Filter Array action, which will go through an array and returns a new array by filtering.

So, in Power Automate click on the Manually Triggered Flow. Then click on the Next step.

microsoft flow filter array variable
Microsoft flow filter array variable

Now, select the Initialize variable action and set the variable name, type as an array, and set the value like below.

microsoft flow filter array variable
Microsoft flow filter array variable

Now we will filter out the name whose age is 28, so click on the Next step and select Filter Array action.

Then set the From with the variable from the dynamic content and in value write the below expression equal to 28.

item()['Age']
power automate filter array variable
power automate filter array variable

Now click on Save and run the flow manually. We can see the result of the name whose age is 28.

power automate filter array variable
power automate filter array variable

This is how to filter array variables in Power Automate.

  • Get daily weather reports delivered to your email and phone using Power Automate

Power automate remove duplicates from an array variable

Here we will see how to remove duplicate values from an array variable using Power Automate.

In Power Automate, select the Manually triggered Flow. Then click on the Next step.

power automate remove duplicates from array variable
power automate remove duplicates from array variable

Select the Initialize variable action and set the variable name, type as an array, and set value like below array:

power automate remove duplicates from array variable
power automate remove duplicates from an array variable

Now we will remove the duplicate item from the above array by using the Union function.

So, click on the Next step and select Compose action. In input write the below expression.

Union(variables('varArray'),variables('varArray'))
power automate remove duplicates from array variable
power automate remove duplicates from array variable

Now click on save and run the Flow, we can see the result after removing the duplicate values out of 5 values, 3 values left.

power automate remove duplicates from array variable
power automate remove duplicates from array variable

This is how to remove duplicates from an array variable using power automate.

Power automate email array variable

Here we will see how to send array in an email using Power automate.

To send an array of items through email, we need to covert the array variable to string, to use in send email using Power Automate.

In Power Automate, select the Manually triggered flow. Then click on the Next step.

power automate email array variable
power automate email array variable

Select the Initialize variable action, and then set the variable name, type as array, and set the value like below array.

power automate email array variable
power automate email array variable

Now we will convert the array into string which we will use later in email.

So, click on the Next step and select Join action from data operation. Then in From set the array variable and in join with comma ‘,’.

microsoft flow email array variable
Microsoft flow email array variable

Next, we will send an email of array values, so click on the Next step and select Send an Email (V2) action.

Now provide the To, subject, and in body part set the output of the Join from the dynamic content.

microsoft flow email array variable
Microsoft flow email array variable

Now click on Save and run the Flow manually, you can see the result in the Outlook email.

microsoft flow email array variable
microsoft flow email array variable

Read Microsoft Flow Example: Copy files from one SharePoint Online account or folder to another

Power automate get array variable

Here we will see get unique values from the array of objects in Power Automate.

See also  Power bi show items with no data

In Power Automate select the Manually triggered Flow. Then click on Next Step.

microsoft flow get value from array variable
microsoft flow get value from array variable

Select the Initialize variable action, then set the variable name, type as array, and in value set the array of objects like below:

microsoft flow get value from array variable
Microsoft flow get value from array variable

From the array of objects, we need to get the unique values of last name. So for this we will first fetch all the last name in the objects.

So we will use the Select action, so click on the Next step and select Select action. Then in Form add the variable from the previous step and next in the Map field switch the map to text mode and write the below expression:

item()['LName']
microsoft flow get value from array variable
Microsoft flow get value from array variable

Now to get the Unique last name, click on the Next step and select the Compose action. Then in input write the below expression:

Union(body('Select'),body('Select'))
power automate get array variable
power automate get array variable

Now click on Save and run the Flow manually. Now we can get the unique value from an array of objects.

power automate get array variable
power automate get array variable

This is how to get array variable using power automate.

Power automate get item from array variable

Here we will see how to get item from array of variables in Microsoft Flow.

We will create a flow from which we will get items from the array of objects in Microsoft Flow

In Power Automate click on Manually triggered Flow, Then click on Next step.

power automate get item from array variable
power automate get item from array variable

Select the Initialize variable action, and then set the variable name, type as array, and set the value like the below screenshot.

power automate get item from array variable
power automate get item from array variable

Now we will get an item that is in the 2nd index of array of objects. So, click on the Next step and select Compose action. Then in input write the below expression.

variables('varArray')?[1]
power automate get item from array variable
power automate get item from array variable

Now click on Save and run the flow manually. We can see the result in the compose output.

power automate get item from array variable
power automate get item from array variable

This is how to get items from an array variable using power automate.

Power automate get first item in array variable

Here we will see how to get first item in array variable in the Microsoft Flow.

We will create a flow that will extract the first item from the array in Microsoft Flow.

In Power automate, click on Manually triggered Flow. Click on the Next step.

power automate get first item in array variable
power automate get first item in array variable

Select Initialize variable action and then set the variable name, type as array, and set the value like below array of objects.

power automate get first item in array variable
power automate get first item in array variable

Now we will get the first item of the object, as we know array index starts with 0, so we will use the index value to get the first item.

So, click on the Next step and select the compose action. In input write the below expression:

variables('varArray')?[0]
power automate get first item in array variable
power automate get first item in array variable

Now click on Save and run the Flow manually. We can get the first item from the array of objects.

power automate get first item in array variable
power automate get first item in array variable

This is how to get first item in array variable in Power Automate.

Power automate length of array variable

Here we will see how to calculate length of array in Microsoft Flow.

In Power Automate, click on Manually triggered Flow. Then click on the Next step.

power automate length of array variable
power automate length of array variable

Select the Initialize variable action, and set the variable name, type as an array, and set the value like below.

power automate length of array variable
power automate length of array variable

Now we will calculate the length of an array by using the length function, so click on the Next step and then select the compose action. In input write the below expression:

length(variables('varArray'))
power automate length of array variable
power automate length of array variable

Now click on Save and run the flow manually, and you can see the length of the array is 4.

power automate length of array variable
power automate length of array variable

This is how to get the length of the array variable in Power Automate.

You may like the following Power Automate tutorials:

In this Power Automate tutorial, we discuss different types of examples by using array variables in Power Automate. The examples are listed below:

  • Power automate array variable apply to each
  • Power automate array variable to string
  • Power automate array variable index
  • Power automate create array variable
  • Power automate variable array of objects
  • Power automate append array variable
  • Power automate add array variable
  • Power automate append to array variable json
  • Power automate filter array variable
  • Power automate remove duplicates from array variable
  • Power automate email array variable
  • Power automate get array variable
  • Power automate get item from array variable
  • Power automate get first item in array variable
  • Power automate length of array variable
  • >