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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Split array items into...
Power Automate
Answered

Split array items into rows in an SQL table

(0) ShareShare
ReportReport
Posted on by

Currently, I have an array that keep up with items and quantity of items:

abyars_0-1698342442342.png

 

I want to create a new row for each item in the array. For instance:

 

SQL Table

----------------------------------------------------------------------------------------------------------------------------

 ID                           Item                                                                                             Quantity

 1                            How many boxes of large bags do you need? (2 max)                 2
 1                            How many TN450 toner cartridges?                                             1
etc...
 
Any help would be appreciated!
Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,716 Super User 2026 Season 1 on at

    You iterate through the array and insert the individual rows into the SQL server table.  Note: Requires Premium license.

  • abyars Profile Picture
    on at

    Could you show me an example? I'm pretty new to Flow.

  • lbendlin Profile Picture
    8,716 Super User 2026 Season 1 on at

    Sure. Please post a usable sample version of the raw array (not a screenshot).

  • abyars Profile Picture
    on at
    [
      {
        "Item""How many 4\" hooks? (48 max)",
        "Quantity""12"
      },
      {
        "Item""How many boxes of large bags do you need? (2 max)",
        "Quantity""2"
      },
      {
        "Item""How many TN450 toner cartridges?",
        "Quantity""1"
      },
      {
        "Item""How many TN660 toner cartridges?",
        "Quantity""1"
      },
      {
        "Item""How many boxes of small bags do you need? (2 max)",
        "Quantity""2"
      },
      {
        "Item""How many bracelet bars do you need? (3 max)",
        "Quantity""3"
      }
    ]
  • Verified answer
    lbendlin Profile Picture
    8,716 Super User 2026 Season 1 on at

    lbendlin_0-1698353448034.png

    Something like this.  You may want to have a primary key/index column in the target table, and maybe another column with the insert date and user who inserted etc.

    lbendlin_2-1698353680705.png

     

    lbendlin_1-1698353503612.png

     

  • abyars Profile Picture
    on at

    Wow, that was much less confusing than I was expecting. That worked!

     

    Unfortunately... I've encountered another problem. In the SQL table I have another column called SupplyID. I am pulling a SKU number for the item if item()?['Item'] = the same item in a Sharepoint list. When I add the SKU in the table, it does not return the values for Item or Quantity, only the SKU number:

     

    abyars_0-1698355029016.png

     

    Here's what my flow currently looks like:

    abyars_2-1698355136009.png

     I'm marking the previous response a solution but would also love your input on this as well if possible.

  • lbendlin Profile Picture
    8,716 Super User 2026 Season 1 on at

    You lost me a bit. Maybe you can describe the whole process?

  • abyars Profile Picture
    on at

    @lbendlin,

     

    I have a completely separate Sharepoint list that contains the list of all the items and their SKU number (backend product number):

    abyars_0-1698410857104.png

     

    If the current item()?['Item'] = Item in Sharepoint list, it should return the SKU number that corresponds with the Item in the list, then return that value in the SupplyID column in my SQL table:

     

    abyars_1-1698411173160.png

     

    However, when I try to populate the SupplyID, the SupplyDesc and SupplyQty columns return blank, and only the SupplyID column populates:

    abyars_2-1698411280708.png

     

    But whenever I remove the SKU field from the Insert SQL row, it populates the SupplyDesc and SupplyQty columns properly:

    abyars_3-1698411363659.png

     

    So somehow, the Get items from Sharepoint list function is keeping the SupplyDesc and SupplyQty from populating correctly.

     

    If you need any additional information, please let me know.

  • lbendlin Profile Picture
    8,716 Super User 2026 Season 1 on at

    There is no need to fetch the SKU list from the sharepoint every time.  It is sufficient to fetch that once at the beginning of the flow.

     

    Then inside the single (!) Apply to each you can do your required lookup (which I don't see yet in your flow).  You need to use a yes/no action or that.

  • abyars Profile Picture
    on at

    I currently have this outside of the apply to each:

    abyars_0-1698413736654.png

     

    But when I try to insert the SKU field into the table, it automatically creates a second apply to each:

    abyars_1-1698413931611.png

     

    The flow runs fine, but at the end it does not create the table:

    abyars_2-1698414027783.png

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 386

#2
Valantis Profile Picture

Valantis 342

#3
Haque Profile Picture

Haque 336

Last 30 days Overall leaderboard