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 / Accessing Array elements
Power Automate
Unanswered

Accessing Array elements

(1) ShareShare
ReportReport
Posted on by 143

I have a flow which looks at incomng email from a specific address and creates an array of the subject heading using the Split command. I would like to the 2nd element of the array in the next step to create an calendar event. 

 

If i just place the arrary in the next element I can see the following structure ["Text element 1","Text element 2"] 

 

Is there a way I can get only "Text Element 2" in my next step.

 

Here is a screen shot of steps

Split Command.png

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

    Hi @Dhiran,

    Please take a try with the following workaround:

    • Add Variables-> Initialize variable action after “Compose” action, Name set to TextArray, Type set to Array, Value set to output of “Compose” action.
    • In “Create event (V2)” action, type the following formula in Subject parameter:
    @variables('TextArray')[1]

    Image reference:2.JPG

     

    The flow works successfully as below:3.JPG

     

    Best regards,

    Kris

  • Dhiran Profile Picture
    143 on at

    Hi @v-xida-msft (Kris) that worked so thank you. The only issue was the expression would not take the "@" symbol but I could just addd the line without the "@".

  • hasannumanoglu Profile Picture
    25 on at

    worked perfectly! 

    Thanks,

    Hasan

  • philkky Profile Picture
    26 on at

    I want to do something similar, I have an array and I was to loop through each entry putting the value in to an HTML table. In this case the formula 

     

    @variables('TextArray')[1]

     

     Will keep giving me the same value for the number of items in the array, how do I increment this number or should I take a different approach?

  • Community Power Platform Member Profile Picture
    on at

    Does anyone know how you would do this (reference an item in array) when there is a variable amount of items. The array is created from a checkbox selection in a Microsoft form and I would want to loop through and create a work item for each instance(item they checked.

  • Dhiran Profile Picture
    143 on at

    After the array is created, you can get the length of the array and then loop through it. 

  • kamotekid Profile Picture
    25 on at

    Hi! Would you create for me a sample flow?
    I'm trying to do the exact same thing, with a variable array based on MS Forms entries.  In my flow I've already initialized a variable with the formula length(outputs('FormsQuestion2')) after splitting the string from MS Forms.  Next step for me is to update a sharepoint list with each array element, and wondering what the most efficient way is since the length can be variable depending on the Forms response.

    Thank you!

  • Dhiran Profile Picture
    143 on at

    Here is my attempt. If you use a compose statement to split your Question 2 it will provide you with an array. and then use this flow

     

    Dhiran_0-1628506034181.png

     

  • kamotekid Profile Picture
    25 on at

    Thank you!  I adapted your sample above and now I'm able to work through the array with variable lengths.

  • SMarchlik Profile Picture
    2 on at

    I have a similar but different and (shocking) more complex request.  I have a long flow that pulls in JSON Objects and places them into an array, where I will eventually put them into a CSV file to send.  However, late in the process I need to update an element of the array:

     

     

    [
      {
        "Employee Id""E501815",
        "First Name""John",
        "Last Name""Brown",
        "Email""John.Brown@MyCo.com",
        "Secondary Email""",
        "Username""",
        "Password""",
        "Hire Date""[Need to insert a date variable value here]",
        "Birth Date""",
        "Role""",
        "Country Code""US",
        "Supervisor Id""E501090",
        "Group Name""",
        "Language""",
        "#Cost Center""",
        "#Department""Operations",
        "#City""",
        "#Supervisor Name""Ricky Bobby",
        "#Job Title""Office Manager",
        "#Management Level""",
        "Supervisor First Name""",
        "Supervisor Last Name""",
        "Ship to Full Name""",
        "Ship to Job Title""",
        "Ship to Address Line 1""",
        "Ship to Address Line 2""",
        "Ship to City""",
        "Ship to State/Province""",
        "Ship to Country""",
        "Ship to Zip/Postal Code""",
        "Printed Language"""
      }
    ]

     

    I've tried everything.  Puzzled.  Any help would be appreciated!

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