Unique field values

I have not seen a solution to make a username (or any other field) unique by a DB check (either at signup or profile updates). Can someone please post how to do so or point in the right direction? Thanks!

This does happen by default for the email field on the sign-up screen. So the function exists but isn’t surfaced as a usable action for any other fields that I have seen.

@dreampulsemedia I also sought this when I was just starting here.
The thing is, @ben1 is right, what do you need it for when the email is already unique. BUT
if you really like to add unique identifier to each record then you need to make additional action to populate an entry or set automatic fields in a form or button actions.

Well, despite the fact that the mail is unique, in my case, I need it to ensure certain data the user inputs manually is NOT repeated in the database, since I use this information to sort lists etc… and duplicate values would ruin its purpose.

Is there really NO way to set a specific database field to unique the same way the user-email is?

:frowning:

@Frostjaw @dreampulsemedia

Try the Randomizer component in the Adalo Marketplace to create unique IDs. That should solve the problem

1 Like

Sounds like worth a try…

Does Adalo check if the next random number already exists? Cause if not… well, chances are slim but we could still get repeated values. If it is trully random that is.

1 Like

Randomizer won’t guarantee uniqueness from what I can see.
I have a similar requirement. I’d like to uniquely key my data rows (for export and efficient synchronisation with an external system). I tried adding an integer ‘Id’ column to my ‘Payments’ table and when I create the database row, setting Id = Maximum Current Id Value + 1 (or current table row count + 1). However if my test app adds a new payment in quick succession (i.e. I quickly press a button which adds a new payment and tries to set its Id using the increment formula above), then I found that my Payments table contains duplicated Id values - e.g. 1,1, 2, 2, 3, 3, 4, 4 instead of 1,2,3,4,5,6,7,8.
I suspect this isn’t a bug per-se and is simply a consequence of Adalo performing database inserts asynchronously of my increment function.

If we have RAND(0,9999999999999) plus the integer action which you suggest below, the changes of two values being picked up at the same time must be fairly slim?

I also need a unique identifier but i’m struggling to find one!

Thanks

Hi @MM792,

This post might be useful: Help with unique id

Best,
Victor

2 Likes