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 / Stop loop if no longer...
Power Automate
Answered

Stop loop if no longer can split

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a set of data that looks like this

 

ALVIN, CHAN, HEY
CALVIN, LEE
MINT, CANDY, LIU, CHING, CHONG

 

and i would like to split it into the following tables

ALVIN CHAN HEY  
CALVIN LEE   
MINT CANDY LIU CHING CHONG

 

so i wrote a create a sets of flows that looks like the following:-

tchong95_0-1643024910497.png

thanks to the following link Solved: Parsing a string - Power Platform Community (microsoft.com)

 

but now I had an issue, this flow will generate errors 

tchong95_1-1643025026807.png

How do I troubleshoot this error? Or is there an easy way to do the loop?

 

Categories:
  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Anonymous,

     

    Within this approach you could check how many items there are in the split. If they are greater or equals to 4 you can reference the index [3]. You need to also implement that for your other compose actions.

     

    Below is an example expression of that approach:

    When the if statement equals true it will collect the split value. When it is false, it will return null.

     

     

    if(greaterorequals(length(split(outputs('Compose'), ', ')), 4), split(outputs('Compose'), ', ')[3], null)

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    how do i put the following formula into power automate?

  • Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Anonymous,

     

    You can add/edit expressions via the expression editor. 

     

    Go to your Compose 5 and replace the existing expression (which I assume is split(outputs('Compose'), ', ')[3]) by the expression below:

    if(greaterorequals(length(split(outputs('Compose'), ', ')), 4), split(outputs('Compose'), ', ')[3], null)

     

    compose5.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This is a great solution but let say if I wanted to future proof my workflow, and make it error-less even after 2 columns (which means onljy one column have name). How do I do it? 

  • Verified answer
    Expiscornovus Profile Picture
    34,005 Most Valuable Professional on at

    Hi @Anonymous,

     

    Like I suggested in my earlier reply, you might want update the rest of your compose actions too 😁

     

    Compose 2

    if(greaterorequals(length(split(outputs('Compose'), ', ')), 1), split(outputs('Compose'), ', ')[0], null)


    Compose 3

    if(greaterorequals(length(split(outputs('Compose'), ', ')), 2), split(outputs('Compose'), ', ')[1], null)


    Compose 4

    if(greaterorequals(length(split(outputs('Compose'), ', ')), 3), split(outputs('Compose'), ', ')[2], null)


    Compose 5

    if(greaterorequals(length(split(outputs('Compose'), ', ')), 4), split(outputs('Compose'), ', ')[3], null)

     

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks man!

    tchong95_0-1643182906865.png

    just a quick follow up to this thread, if let say I want to write it to a table in excel, with which connector will it be most suitable in my position?

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#2
Henil Profile Picture

Henil 128

#3
anirudhev Profile Picture

anirudhev 124

Last 30 days Overall leaderboard