Skip to main content

Selecting a random row/record in a table and displaying results


I’ve seen this question asked a few times but still no solution. I would like to use airtable as the database for my trivia app. I need a way to randomly select row/record which will have the question, and then display the contents. The part I havent seen a solution to yet is how to select a random row/record from only the populated rows. Any ideas?

2 replies

kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5992 replies
  • May 10, 2020

Here is one possible method:

  1. Create a new field for a random value.
  2. Set the random value either using the Batch update block or Scripting block.
  3. Sort according to the random value field and take the first record in the view.

ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8730 replies
  • May 11, 2020

You might love using Airtable’s Flashcard Block. It randomly goes through your records and does exactly what you have requested — it randomly pulls the questions & answers from your base.


Reply