Features/Duplicate prevention

From TempusServa wiki
Revision as of 09:36, 28 August 2023 by Nun (talk | contribs) (→‎How to do)
Jump to navigation Jump to search

What it is

Example:

 If you are adding a record to an entity, it would be annoying to later find out that the record already exists. Now you have two records with the same data, but with different DataIDs. To prevent this there should be some part of the data in the record that is impossible to exist in another record. An example of this would be the social security number of a person. If you are adding a record of a person whose SSN already exists in the system, then the person is certainly a duplicate.

How to do

To prevent duplications when records are created, the entity needs to be set up right. Either a single field or a combination of fields need to be designated as being a unique key, meaning that if you attempt to create another record with the same combination of fields, you will be prevented form doing so. This can be some field with inherently unique data or for example the combination of a date and a name, where the chance of another record sharing the same date and name is considered extremely unlikely.

To set a field of an entity to be a unique key, go to that entity in the back-end and select your chosen field as shown in picture 1.

Picture 1

The unique key feature is an advanced one, which means that you have to toggle the advanced view as shown in picture 2.

Picture 2

Now enable the check mark as shown in picture 3.

Picture 3

Your chosen field is now part of a unique key. If this is the only field with this check mark enabled, then this will be the only key. If you select a second or third field, then the combination of the values of those fields will be the unique key.