Forum Discussion

jamescosten's avatar
jamescosten
Brass Contributor
Nov 30, 2022

Randomly Select Entries in your Sharpoint List for Review

I have a sharepoint list that is recording the lcoation of stock. Once a week or MOnth i would like power automate to randly choose 10 items in the list for review. They will use the list to capture the correct item is in the correct location etc.

Is there a way to randomly select items?

  • Get the items with the first ID and last ID, then create a variable and add rand(firstval,lastval) and generate, then run it and update it 10 times or something 🙂
    • jamescosten's avatar
      jamescosten
      Brass Contributor
      I used this: body('Get_items')?['value'][rand(0,length(body('Get_items')?['value']))]

      But it only returns 1 item, can i change it somehow to recieve 5 random items?
      • RobElliott's avatar
        RobElliott
        Silver Contributor

        jamescosten you could have a parallel branch for each of the random items you want to bring back, each with the expression to get the random item, the parse json action and then append it to a string variable. Then you can use that to, for example send an email.

         

         

         

        Rob
        Los Gallardos
        Microsoft Power Automate Community Super User

Resources