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 / Create Array from Shar...
Power Automate
Unanswered

Create Array from SharePoint Columns

(1) ShareShare
ReportReport
Posted on by 15
 
Hello team, I hope you can help me here, I have a SharePoint list, it has multiple items, but basically one item looks like the one below:
 
 
The question is if there is a way to create an array like the one below:
 
[
{
Column A: Item Z
Column B: cat 2
Column C: 5
},
{
Column A: Item B
Column B: cat 4
Column C: 8
},
{
Column A: Item A
Column B: cat 1
Column C: 9
}
]
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at
    Are you column A, B and C multi-choice fields? If that is the case you could use an array to create one big array. If these are text fields you might want to use a split function as well.
     
    Below is an example which assumes these are multi-choice fields.
     
    The apply to each uses the expression below to determine the max number of loops
    range(0, max(createarray(length(triggerOutputs()?['body/ColumnA']),length(triggerOutputs()?['body/ColumnB']),length(triggerOutputs()?['body/ColumnC']))))
    The Append to array variable action uses the below json. It uses the current item as an index number to retrieve the correct value. 
    {
      "Column A": "@{triggerOutputs()?['body/ColumnA']?[item()]?['Value']}",
      "Column B": "@{triggerOutputs()?['body/ColumnB']?[item()]?['Value']}",
      "Column C": "@{triggerOutputs()?['body/ColumnC']?[item()]['Value']}"
    }
     
    The test result
     
  • CU27091846-0 Profile Picture
    15 on at
    Hello,
     
    Thanks for the reply, sadly all the columns are text. Can you please help?
     
     
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at
    Like mentioned in my previous reply. In that case you can use the split function as well. The approach is pretty similar.
     
    Below is an update example for the text type of column.
     
    The apply to each uses the expression below to determine the max number of loops
    range(0, max(createarray(length(split(triggerOutputs()?['body/ColumnA'],',')),length(split(triggerOutputs()?['body/ColumnB'], ',')),length(split(triggerOutputs()?['body/ColumnC'], ',')))))
    The Append to array variable action uses the below json. It uses the current item as an index number to retrieve the correct value. I have also added a trim function because some values are separated by ', ' instead of ','
     
    {
      "Column A": "@{trim(split(triggerOutputs()?['body/ColumnA'],',')?[item()])}",
      "Column B": "@{trim(split(triggerOutputs()?['body/ColumnB'],',')?[item()])}",
      "Column C": "@{trim(split(triggerOutputs()?['body/ColumnC'],',')?[item()])}"
    }
     
     
  • CU27091846-0 Profile Picture
    15 on at
    I really apologize, I really thought that I was going to be able to fit your solution into my flow, but I am not able to, maybe I should've mention that the data is coming from a select function and the output is like this:
     
    [
      {
        "Column A": [
          "Item Z",
          "Item B",
          "Item A",
        ],
        "Column B": [
          "cat 2",
          "cat 4",
          "cat 1",
        ],
        "Column C": [
          "5",
          "8",
          "9",
        ]
      }
    ]
     
    Can you please help? I guess I should create a new post and mark this one as resolved.
     
    Thank you for any help,
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
    HI
     
    Yes its critical that you share your flow, how you get the data, where it comes from etc etc.
     
    Or as you can see it makes it impossible for folks to help.
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at
    Based on your output I would say these columns are actually multi choice fields. Each column has returned an array, hence the [] around the values.
     
    Can you try the first approach I shared?
     
    And if it doesn't work please share your flow setup, like FLMike already suggested. This makes it easier for us to suggest an approach/troubleshoot.
  • CU27091846-0 Profile Picture
    15 on at
    Thank you for the response,
     
    The information comes from a SharePoint text column. (3 columns). I wish I could share screenshots, but I am not allowed due to confidentiality company rules. Then I am using a select splitting the text by the coma, that is why you see the information in an array form.
     
    [
      {
        "Column A": [
          "Item Z",
          "Item B",
          "Item A",
        ],
        "Column B": [
          "cat 2",
          "cat 4",
          "cat 1",
        ],
        "Column C": [
          "5",
          "8",
          "9",
        ]
      }
    ]
     
    From this step I am stuck to merge the arrays into one, the items and the order will always match, meaning the first value from Column A goes with the first value of Column B, and the first value of Column C.
     
    I understand if the lack of flow images makes my explanation complicated.

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