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 Apps / Auto splitting concat ...
Power Apps
Unanswered

Auto splitting concat emails into different batches

(0) ShareShare
ReportReport
Posted on by 47

I have a collection with emails as below:

 

1@yahoo.com
2@yahoo.com
3@yahoo.com
4@yahoo.com
5@yahoo.com
6@yahoo.com
7@yahoo.com
8@yahoo.com
9@yahoo.com
1@yahoo.com
2@yahoo.com
3@yahoo.com
4@yahoo.com
5@yahoo.com
6@yahoo.com
7@yahoo.com
8@yahoo.com
9@yahoo.com
10@yahoo.com

 

I have a label concat these email into below, which targets to send out a single email. 

The number of emails will vary, and I would like to split the concat emails into different batches in Power Automate, such that total 5 emails will in 1 batch. Is there any good idea to achieve this?

1@yahoo.com;2@yahoo.com;3@yahoo.com;4@yahoo.com;5@yahoo.com;6@yahoo.com;7@yahoo.com;8@yahoo.com;9@yahoo.com;10@yahoo.com
Categories:
I have the same question (0)
  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    Hi @Majingcth , 

    If you want to send an array to Power Automate flow you will need the JSON() function on Power Apps app side and a Parse JSON action on PowerAutomate.

    Here is a short example of PowerApps code, starting from your request:

    ClearCollect(
     Mails,
     Split(
     "1@yahoo.com;2@yahoo.com;3@yahoo.com;4@yahoo.com;5@yahoo.com;6@yahoo.com;7@yahoo.com;8@yahoo.com;9@yahoo.com;10@yahoo.com;11@yahoo.com",";"
     )
    );
    ClearCollect(
     MailsSplitBy5,
     With({rows:CountRows(Mails)},
     ForAll(
     Sequence(RoundUp( rows/ 5,0)),
     With(
     {
     Last5: LastN(FirstN(Mails,5 * Value),If(Value>RoundDown(rows/ 5,0),Mod(rows,5),5))
     },
     Concat(Last5,Result & ";")
     )
     )
    ));
    Set(JSONforFlow,JSON(MailsSplitBy5))

    Hope it helps !

     

  • Majingcth Profile Picture
    47 on at

    Could you provide a little bit explanation on below code.  

     

    ClearCollect(
     MailsSplitBy5,
     With({rows:CountRows(Mails)},
     ForAll(
     Sequence(RoundUp( rows/ 5,0)),
     With(
     {
     Last5: LastN(FirstN(Mails,5 * Value),If(Value>RoundDown(rows/ 5,0),Mod(rows,5),5))
     },
     Concat(Last5,Result & ";")
     )
     )
    ));

     

  • Verified answer
    CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @Majingcth ,

    So 

     With({rows:CountRows(Mails)}

    rows is a temporary value used inside with () function (i prefer not to repeat same function call like CountRows() here)

    ForAll(
     Sequence(RoundUp( rows/ 5,0)),
     

    I calculate the number of batches of 5  items using RoundUp( rows/ 5,0).

    Sequence() function create an array of numbers from 1 to .... max number of batches.

    And ForAll iterates through resulting array to obtain a table. 

     With(
     {
     Last5: LastN(FirstN(Mails,5 * Value),If(Value>RoundDown(rows/ 5,0),Mod(rows,5),5))
     },
     Concat(Last5,Result & ";")
     )
     )

     I took batch of 5 by batch of 5 and create a item in table. 

  • Majingcth Profile Picture
    47 on at

    Thanks for the guidance, will give it a try.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard