Few of our community members asked if there is way to randomly sort airtable records while displaying them in softr lists.
While airtable is not providing an easy way to do it we have developed small code snippet to be injected in the page header area which will randomly sort the records which are being displayed to the end user.
Okay. Good to know but this way you can’t use it as the results above the number shown on the page will never be random and will never show up on the first page result. Having to delete this code.
Any way of getting random results from an airtable?
We would like to show 1 non-profit in the spotlight (random) on the homepage of the website.
Hey @artur, I’ve pasted your code snippet into the header of my page but it doesn’t seem to be working. Did the Airtable API’s change or is there another reason you can think of?
So this is not receiving random records from airtable, right? This just randomly sorts the in my case 12 records it receives. Or am I doing something wrong?
i.e. i have 500 records sorted alphabetically in airtable, i want softr to display 12 records from that table randomly. When i use the script it merely shuffles the first 12 records from that table, and disregards the other 488 records from the table…
Hi,
Thanks for the code that works very well.
Is it possible, if there are 2 dynamic blocks on the page, to apply it only to one of these 2 dynamic blocks?
Thanks !