
Announcements
Hello,
I need assistance in creating a build that can create a random picker to pull 5% of the data population. I've created these steps so far, with this expression under the compose action.
body('List_rows_present_in_a_table')?['value'][rand(1, length(body('List_rows_present_in_a_table')?['value']))]
However, this will only pick 1 random item from the list. How can I update it to choose 5% of the population?
This is not totally random, but maybe random enough.
The idea is to add a property 'Sort' with a random number.
Then sort by this number and take the first 5% items.
Select
Just generates some objects
Select 2
Adds the Sort property
Map:
addProperty(
item(),
'Sort',
rand(0, 1000000000)
)
Use a high limit to reduce the probabilty of duplicates.
Compose
Sorts by the random numbers and takes the appropriate amount of items
take(
sort(
body('Select_2'),
'Sort'
),
div(
length(body('Select_2')),
20
)
)