How to ensure unique values

How would I go about ensuring that a specific column in my table is always unique?

Hi @Mark Lalich 

If you referring to the attribute of an entity if you try to give an existing name to the attribute the platform will add a number automatically to prevent having duplicated names inside the same entity.

If you referring to values, like a primary key that should be unique, you can create an index and set the attribute as unique.

Click on the button to open the popup, go to the index tab, create an index, and set the attribute that you want as unique.

Also, you can check this video to understand better: https://www.outsystems.com/training/lesson/2150/indexes.

Another way is to build logic that will check on the database if the value already exists.

Regards

Gonçalo Almeida


If we do this can we avoid a combination

Let's say database should throw an error when we have a concurring combination of name, mobilenumber and deletedon columns

Hi Mark,

You can also refer the below link in addition of what @Goncalo Almeida mentioned to get more about unique values.

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Data_Modeling/Entities

Thanks & Kind Regards,

Sachin

Champion

Hi Mark, 

I think you can use the Id as the unique key. The id is autonumber. You can put the hyperlink in any of your table column. This hyperlink will pass in the Id parameter to the detail screen.

Hope it helps

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.