cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
krishnags
Responsive Resident
Responsive Resident

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 column 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 the whole cumbersome process, 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

5 REPLIES 5
ChristianAbata
Community Champion
Community Champion

hi @krishnags  Sorry if I missundersthand but you can use the expresion String('Yourvalue') to convert what ever you want to string.



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

@ChristianAbata Yeah, I agree. But in the example I have given, I need to have an array to convert as string from [1,2,3,4,5] to 1,2,3,4,5 which altogether changes its data type and the value with out brackets. But when I tried with sting(variables('varArray')), it was giving me the value as string but with brackets. So, I thought of sharing this with you all and might help.

 

feel free to add your thoughts to this.

 

function: joinfunction: joinfunction : stringfunction : string

ok @krishnags  please do this to delete the last and the firts character from string.

 

1.PNG2.PNG

 

substring(outputs('Compose'),0,sub(length(outputs('Compose')),1))

 

substring(outputs('First'),1,sub(length(outputs('First')),1))

 



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

@ChristianAbata yeah, but if we go with JOIN, we can eliminate  substring(outputs('Compose'),0,sub(length(outputs('Compose')),1))  this finding length, getting substring and all. simply use JOIN and get the things done 🙂

shure @krishnags  so this solve your problem or not friend jejeje



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,234)