web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert array to string
Power Automate
Unanswered

Convert array to string

(1) ShareShare
ReportReport
Posted on by

 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

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    on at

    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 Power Platform Member Profile Picture
    on at

    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.

  • Community Power Platform Member Profile Picture
    on at

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

  • Community Power Platform Member Profile Picture
    on at

    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

  • Community Power Platform Member Profile Picture
    on at

    @v-xida-msft 

    Thank you very much for the solution. It really helped.

  • dimplun Profile Picture
    16 on at

    hi @v-xida-msft 

     

    I have somewhat similar requirement but cannot go through it with your current solution.

     

    I have this as my original array:

    [
     {
     "Field 1": "Value 1.1",
     "Field 2": "Value 1.2",
     "Field 3": "Value 1.3",
     "Field 4": "Value 1.4"
     },
     {
     "Field 1": "Value 2.1",
     "Field 2": "Value 2.2",
     "Field 3": "Value 2.3",
     "Field 4": "Value 2.4"
     }
    ]

     

    Initially, I want to send an email containing the array which I have transformed to HTML Table like this:

    Field 1Field 2Field 3Field 4
    Value 1.1Value 1.2Value 1.3Value 1.4
    Value 2.1Value 2.2Value 2.3Value 2.4

     

    But as it turned out, the table layout is to tight because my table has too many columns to fit in a HTML view. So I decided to transform the layout into something like this:

    Field 1: Value 1.1
    Field 2: Value 1.2
    Field 3: Value 1.3
    Field 4: Value 1.4
    
    Field 1: Value 2.1
    Field 2: Value 2.2
    Field 3: Value 2.3
    Field 4: Value 2.4

    but I cannot figure out how to transform the original array.

     

    Appreciate if you can look into it and help. Many thanks.

  • DanielS19 Profile Picture
    9 on at

    Is it possible to skip lines for each string?

  • DanielS19 Profile Picture
    9 on at

    Is it possible to skip lines for each string ?

  • Apaulo Profile Picture
    3 on at

    Thank you so much for posting this; it worked perfectly!

  • ValleskaMatoso Profile Picture
    2 on at

    No meu aparece 

    A operação 'Inicializar variável' só pode ser usada no nível superior.
     
    Estou usando apos recebe um e-mail, obter o anexo, criar o arquivo, criar a tabela e listar a tabela.
    Apos juntar as informações em uma unica linha iria enviar o texto pelo teams.
     
    Poderia me ajudar?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard