The array function will convert any value into an array. By any value, I mean one value only! The point of this function is not to parse a string and break it down into multiple elements in an array (for that, check the createArray function). Although it’s not used a lot, this function provides two steps in one. Create an array and populate it with data.
You can achieve the same with a “createArray function” with only one parameter, so you may wonder why Microsoft created this function. The reason is consistency. Since we have other functions like the “int function” for example, where we convert a value to an integer value, the same happens with the “array function”. We’re converting or “casting” a value into an array. With this Microsoft keeps the name of the type (int, float, array) as the function to convert the value so that you always know that to convert to something you use its name as the function.
It follows a simple pattern where you provide any value (string, boolean, int, float, etc.), and it will return an array with that value as the first element.
Let’s start with a simple example:
array('Manuel') will return [ "Manuel" ]
It works with all the other types that you would expect:
array(15) will return [ 15 ]
array('3.14') will return [ 3.14 ]
array(true) will return [ true ]
You can only provide one parameter. There is another function (the createArray function) where you can provide multiple objects, and it will create an array with multiple elements.
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 array functions in a formula, you should review it and make everything more straightforward.
Back to the Power Automate Function Reference.