cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IntrepidExploer
Level: Powered On

Convert array to string

 I have an array of items that I need to convert into a string. I need the text to go into a plain text email form which is submitted into our ticketing system.

 

I've tried various `join` and `concat` options but can't get the result I expect. The data comes from a multiple entries group/person field from SharePoint via a PowerApps form. I have transformed the data to an array, but this is where I am stuck.

 

I want to go from this:

 

 

[
  {
    "DisplayName": "Bob Jones",
    "Email": "bob.jones@example.com",
    "JobTitle": "Singer"
  },
  {
    "DisplayName": "Jane Doe",
    "Email": "jane.doe@example.com",
    "JobTitle": "Lighthouse Painter"
  }
]

 

 

 

 

To this:

 

 

Bob Jones - bob.jones@example.com - Singer
Jane Doe - jane.doe@example.com - Lighthouse Painter

 

 

Any help appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Convert array to string

Hi @IntrepidExploer,

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> “Initialize variable” action, Name set to OriginalArray, Type set to Array and Value set to the array that you provided.
  • Add a Variables-> “Initialize variable 2” action, Name set to FinalString, Type set to String and Value set to empty.
  • Add a “Apply to each”, “Select an output from previous steps” field set to variable OriginalArray.
  • Within “Apply to each”, add a “Compose” action, Inputs set to following formula:
concat(item()?['DisplayName'],' - ',item()?['Email'],' - ',item()?['JobTitle'])

 

Add a “Compose 2” action, Inputs field set to following formula:5.JPG

Note: Within Inputs field, type Output dynamic content of “Compose” action in first line, then type variable FinalString in second line (type “Enter” key in your keyboard).

 

Add a “Set variable” action, Name choose FinalString and Value set to output of “Compose 2” action.

 

  • Under “Apply to each”, add a “Compose 3” action, Inputs set to variable FinalString.

Image reference:6.JPG

 

7.JPG

The flow works successfully as below:8.JPG

 

9.JPG

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Convert array to string

Hi @IntrepidExploer,

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a Variables-> “Initialize variable” action, Name set to OriginalArray, Type set to Array and Value set to the array that you provided.
  • Add a Variables-> “Initialize variable 2” action, Name set to FinalString, Type set to String and Value set to empty.
  • Add a “Apply to each”, “Select an output from previous steps” field set to variable OriginalArray.
  • Within “Apply to each”, add a “Compose” action, Inputs set to following formula:
concat(item()?['DisplayName'],' - ',item()?['Email'],' - ',item()?['JobTitle'])

 

Add a “Compose 2” action, Inputs field set to following formula:5.JPG

Note: Within Inputs field, type Output dynamic content of “Compose” action in first line, then type variable FinalString in second line (type “Enter” key in your keyboard).

 

Add a “Set variable” action, Name choose FinalString and Value set to output of “Compose 2” action.

 

  • Under “Apply to each”, add a “Compose 3” action, Inputs set to variable FinalString.

Image reference:6.JPG

 

7.JPG

The flow works successfully as below:8.JPG

 

9.JPG

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

IntrepidExploer
Level: Powered On

Re: Convert array to string

Hi @v-xida-msft,

 

Thanks for your help. That's an excellent solution. I really appreciate the time you put into producing that example.

 

Cheers.

Parmi
Level: Powered On

Re: Convert array to string

Just what I needed. Awesome solution. Thanks a lot.. 

gonzalez_21
Level: Powered On

Re: Convert array to string

Can this work for a Sharepoint List?

 

for example I have two emails seperated in items in a List. I want to join (Concat) the emails together to send a approval to multiple people base of the Sharepoint list. Im trying with Get Items but i don't seem to get it. Im new with Microsoft Flow

 

Thanks

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 54 members 3,490 guests
Please welcome our newest community members: