Enforce column value is unique (distinct)

How to check or ensure that a text field is unique within the column.
I have text field that user need to keyin a value , id like to prevent user to enter an existing value from that column.

Something like ;

SELECT CASE WHEN count(distinct col1)= count(col1)
THEN 'column values are unique' ELSE 'column values are NOT unique' END
FROM tbl_name;

Thanks!

Glide doesn’t provide any native mechanism for enforcing uniqueness. To do so, you need to create your own logic in the data editor.

The general approach is to use a multiple relation that matches the column in question to itself, and then check if the relation is empty or not.

The below (copyable) concept app demonstrates how this can be done

2 Likes

Thanks again Darren for quick respond and guidance, I was thinking that if Im just missing something basic functionality within glide. Will do make some internal cross validation for desired output.

Cheers!