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 Apps / App Feasibility Query
Power Apps
Answered

App Feasibility Query

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all, I`m trying to create a company app for a specific department but have hit a brick wall. Scouring the web for advice/help/tutorials hasnt thrown up any solutions. If I list the main part of the process I`m trying to automate in the app could someone tell me if its possible?

 

I`ve got 12 factories and each factory has a set number of workers.

 

1. I want to randomly pick 1 factory

2. Then randomly pick 6 workers from that factory.

3. Once those workers have been chosen at random I want to mail them. 

 

I`ve found a solution to the first part of the process, my next hurdle is then using the output factory to pick 6 random workers for checks. The RAND function really only applies to numbers, and even then it really just randomises the decimal number. There is a shuffle function but not sure if thats a feasible option and if so, how I can make it shuffle the list of workers and only show the first 6. And if we reach that point how we can then link those workers to mail addresses so mails can be sent to all 6 to notify them they`ve been chosen for spot checks.

 

If anyone can let me know if this is even possible I`d be incredibly grateful.

Regards

ALan Dobson

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    Could you please share a bit more about your scenario?

    How do you randomly pick 1 factory within your app?

    Could you please share more details about your data source?

    I assume that you use a data source to store all works in all factories, and there are some columns within it, e.g. WorkerName, Email (store Worker's email), FactoryName, ... etc.

    I think your thought is proper, I think the Shuffle() function could achieve your needs. I have made a test on my side, please take a try with the following workaround:10.JPG

    On your side, add a "Random Workers" button within your app, set the OnSelect property to following:

    ClearCollect(
    RandomWorkersCollection,
    FirstN(
    Shuffle(Filter('datasource', FactoryName = OutputFactory)),
    6
    )
    )

    Note: The Filter('datasource', FactoryName = OutputFactory) formula would return all workers in the random output factory generated in your Step 1.

    The Shuffle function would randomly reorder all workers in the random output factory generated in your Step 1.

     

    Then for your third step, I think the Office365.SendEmail() function could achieve your needs. On your side, please take a try with the following formula:

    ForAll(
    RandomWorkersCollection,
    Office365.SendEmail(Email,"Spot Check Notification", "You have been chosen for spot checks") /* <- Email represents the Email column in your data source */
    )

    At last, you should type the following formula within the OnSelect property of the "Random Workers" button:

    ClearCollect(
     RandomWorkersCollection, 
     FirstN(
     Shuffle(Filter('datasource', FactoryName = OutputFactory)),
     6
     )
    );
    ForAll(
     RandomWorkersCollection, 
     Office365.SendEmail(Email,"Spot Check Notification", "You have been chosen for spot checks") /* <- Email represents the Email column in your data source */
    )

    More details about the Filter function and Shuffle function in PowerApps, please check the following article:

    Filter function

    Shuffle function

     

    Best regards,

    Kris

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Cheers Kris, much appreciated, that definitely helped! 🙂

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 Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard