02/08/2020

Convert an array to string in Power Automate (MS Flows)

converting an array value to a string using Power Automate out of the box function.

"how to convert an array to string" in MS Flows.

Basically, we can use "split" function to convert an array into string but we may end up having extra comma to the last value. To remove that we have to use another expression which checks for the string length and removes the last character [

substring(variables('varListOfRequestIDs'),0,sub(length(variables('varListOfRequestIDs')),1)) ].

To avoid this round about process rocess, we can leverage Power Automate's simple and out of the box function - join

Here is an to show how can we convert an array to string. for instance let's consider, we have an array [796759,933436,926050,1388108,762632,764554]. But as per the requirement, we need to convert it to string and send that value as 796759,933436,926050,1388108,762632,764554. 

varListOfRequestIDs = [796759,933436,926050,1388108,762632,764554]

varStringListOfRequestIDs:join(variables('varListOfRequestIDs'),',')

 gives us 796759,933436,926050,1388108,762632,764554

No comments:

Post a Comment