cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ppl
Helper V
Helper V

Split SharePoint list by flow

Hello.

I have SP list with users.

And I need to split them into random pairs.
What is the best way to do this using MS Power Automate?

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @ppl :

Power Automate does not have a random sorting function. The method I use is to randomly intercept the array multiple times and recombine it to achieve a function similar to random sorting.

I've made a test for your reference:

1\The Table

vbofengmsft_0-1624334682748.png

2\The Result:

vbofengmsft_1-1624339160208.png

3\My Flow:

vbofengmsft_2-1624339304040.png

vbofengmsft_3-1624339386192.png

vbofengmsft_4-1624339447840.png

Best Regards,

Bof

 

 

 

View solution in original post

12 REPLIES 12
v-bofeng-msft
Community Support
Community Support

Hi @ppl :

Power Automate does not have a random sorting function. The method I use is to randomly intercept the array multiple times and recombine it to achieve a function similar to random sorting.

I've made a test for your reference:

1\The Table

vbofengmsft_0-1624334682748.png

2\The Result:

vbofengmsft_1-1624339160208.png

3\My Flow:

vbofengmsft_2-1624339304040.png

vbofengmsft_3-1624339386192.png

vbofengmsft_4-1624339447840.png

Best Regards,

Bof

 

 

 

View solution in original post

@v-bofeng-msft 

Checked it twice, but it gives me different, but not random results

ppl_0-1624345991313.pngppl_1-1624346000071.pngppl_2-1624346006704.png

 

v-bofeng-msft
Community Support
Community Support

Hi @ppl :

Please check if you added this action:

vbofengmsft_0-1624351554614.png

Best Regards,

Bof

 

ppl
Helper V
Helper V

@v-bofeng-msft Thank you!
And last question,

If I make another column with Person type. How I can get it in the end of this flow? To send email for example.

v-bofeng-msft
Community Support
Community Support

Hi @ppl :

This flow does not support person type column.If the field is a Person column,it will be a much more complex problem.

Best Regards,

Bof

ppl
Helper V
Helper V

@v-bofeng-msft  i just use emails instead of names UserA UserB))

but now i have another problem with your flow. If count of users is odd - there is a mistake. any ideas how to fix it?

v-bofeng-msft
Community Support
Community Support

Hi @ppl :

Please try this:

vbofengmsft_0-1624846313840.png

Best Regards,

Bof

 

@v-bofeng-msft 

but now we lost one User from the list. Can we add him in one of the groups?

v-bofeng-msft
Community Support
Community Support

Hi @ppl :

1\Add one more condition action to check if 

equals(mod(length(outputs('getXXXX')?['body/value'],2), 1)

2\If Yes

Add a append to Array variable action and then append this object to 'The table':

 

{

"User1":@{last(output('Compose_4'))['TheUser']}

}

 

Because my original flow has been deleted, the above formulas are all manually entered by me. There may be some errors. I think you should be able to understand what I mean.

Best Regards,

Bof

ppl
Helper V
Helper V

@v-bofeng-msft 

Condition is ok, but I  cant add it to array.

 

ppl_1-1625132944100.png

ppl_2-1625132960774.png

 

 

 

How the schema of this array will looks like in the case of odd count?

{

User1:""

User2:""

User3:""

}

 

v-bofeng-msft
Community Support
Community Support

Hi @ppl :

I've made a test but did not encountered any problem:

vbofengmsft_0-1625191355429.png

The Result:

vbofengmsft_1-1625191423136.png

Best Regards,

Bof

 

ppl
Helper V
Helper V

@v-bofeng-msft 

and if I need to send emails to this users? for example I will replace names UserA UserB to emails. How I can get them from array?

I need to send one email to first group, another to second, another to third etc...

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,297)