How to select a preset number of records from the whole table and update them?

:robot: Make Bot here bringing solutions to some of your FAQs :robot:


:question:

Hello, I am looking to search my table of records (1000 records), randomly select 8 of those records and update a certain field in them.

Currently I am using Search (limit to 8) + Update, but that only updates the top 8 records in the view, I would like for any record in the view to be able to be selected, not just the top 8 in the sort.


:reply:

You could sort this with the Array aggregator and Iterator modules as shown in the pictures below.

  • The Search Records module would be set to search without any limit and the Array aggregator module would aggregate the record IDs.

  • The Iterator module would then use the output array with the Shuffle function that randomly re-arranges the item order in the array.


  • The filter after the Iterator module would then let only the first 8 records.


The described workaround would then effectively choose only 8 random records from all records in the table.