Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Topic Solved /// Randomly generated Person

(0) ShareShare
ReportReport
Posted on by 8

Topic Solved ///

 

 

Hello everyone,
I am currently in the process of developing an app that generates random pairs of two from a collection of employees (approx. 20).
At the beginning, I want to be able to select the number of calendar weeks from a dropdown list how many of these operations should take place.
An employee may only be grouped with the same person once per calendar week and if several calendar weeks are generated, the same 2 employees may never be grouped together. I hope that I have expressed myself clearly.

I already have the code that generates the pairs for one run. But how I now have to rebuild the code for multiple passes (and in such a way that the persons are checked), I don't understand.

 

+ At the end, the generated list must be patched into the SP list (chat partners are Office365 person columns!) and displayed separately by calendar week.

 

Does anyone have any ideas? if anyone has a simpler idea, i am grateful for it.

 

The Code for now is this one:


ForAll(
Sequence(CountRows(colEmployeesAll) / 2),
Collect(colChatPartner,Last(FirstN(colEmployeesAll,RandBetween(1,CountRows(colEmployeesAll)))));
RemoveIf(colEmployeesAll,ThisRecord in colChatPartner);
Collect(colChatPartner,Last(FirstN(colEmployeesAll,RandBetween(1,CountRows(colEmployeesAll)))));
RemoveIf(colAcademyAll,ThisRecord in colChatPartner);
Collect(
colChatCouple,
{
ChatPartner1: Last(FirstN(colChatPartner,1)),
ChatPartner2: Last(FirstN(colChatPartner,2)),
CalendarWeek: ISOWeekNum(Today())
}
);
Collect(SPList, colChatCouple);

RemoveIf(
colChatPartner1, Not(IsBlank(ThisRecord))
);

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 65 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 55 Super User 2025 Season 1

Overall leaderboard