Arrays are part of the building blocks of Power Automate. We can get arrays from many actions like the SharePoint “Get Items” action, for example. But there are a lot of times that we only want the first element of the array. So that’s where the Power Automate “first “function comes into play.
Let’s see how to use it efficiently.
It follows a simple pattern.
- Array to parse
Let’s start with a simple example:
createArray('Manuel','T','Gomes') first(<array>) will return 'Manuel'
How about if the array is empty?
We’re using the createArray function to generate a test array, but you’ll probably use another action in your case.
Finally, let’s check if it’s a string. We can do the following:
first('Manuel,T,Gomes') will return 'M'
Here you can consider the string as an array of characters. The Power Automate “first “function will return the first character of the array. The same happens if there are spaces in a string.
first('Manuel T Gomes') will return 'M"
I could not find any limitations for this function, but please let me know if you do.
Here are some things to keep in mind.
There’s no real reason to do it, but if you find yourself in a situation where you have nested the first functions in a formula, you should review it and make everything more straightforward.
Back to the Power Automate Function Reference.