A nice trick to make unique codes in Glide (without GSheets)

The challenge - how to make a unique random code in Glide … without using GSheets (slow, etc).

The @Darren_Murphy trick:

  1. lookup table with a single column full of characters that you want to include (in my case, I exclude some numbers and letters are they might be confusing to read or say)
  2. in the table where I will need the code, my two-character code is made up of two single value columns, both picking random values from the lookup + a template column that combines them together
  3. in my app, I have a moment when the user needs to click on a button to initiate a process. At that point I have an action that does Set Columns, taking the continuously changing 2-char string… and bakes it into a ‘Code’ column, to set it for the process.

Magic! And gets rid of the last GSheet formula I was stuck with :slight_smile:

Screenshot 2021-05-11 at 22.25.38


I wouldn’t exactly call it unique… but then that wasn’t a requirement, eh? :wink:

1 Like

Let’s call it ‘unique enough’ for the requirement :slight_smile: :slight_smile:

1 Like

Would a combo action fire quick enough if you include a relation to check for duplications, then if the relation is not empty, let’s say reshuffle and then set column?

As I was typing this, I’m thinking if it generates a duplicate again then it also won’t work :sweat_smile:


If we wanted something truly unique, then I think we’d just use RowID and be done with it :joy:

1 Like

in my case the only issue would be the same user gets the same code at some point over the next months. It is not a disaster though, as the user needs to also do a drawing… and they have to use the camera (on mobile) to upload their photos. And we do a date check in the EXIF data from the photo to see when the photo was originally saved… and validate that against the timestamp of when the process started.

1 Like

This may be of some use for random codes generated with sheets…