How to delete record when duplicate?
I have this situation:
I wish that when I create the new record, delete the last one if it has the same code.
This should work like this:
I have a table called CERT that has a field called CODE that never repeats (uses sequential formula) and is not duplicated.
This table called CERT is related to the BAUNI table through the CODBAUNI field, where this CODBAUNI field can always duplicate.
So I would like that, in the CERT table records, the CODBAUNI field always kept the new record when duplicating.
Is it correct to use this functionality? How ?
Why would you delete the previous record with the same unique code when you can just edit it?
Assuming the properties you printed belong to the CODE field, with 'Zero on duplicate' ('Apaga ao duplicar') you are specifying that the CODE field is to be cleared in the record you create from using the 'Duplicate' action on records. It has no effect on new records that have simply been inserted.
Deleting records is a really bad practice that usually just leads to even bigger problems like unwanted data loss, orphaned records and data fragmentation.
Find a way for the user to search if the record already exists before creating a new one. The 'non duplicate' validation will already warn the user they cannot save a duplicate record, so you just have to provide the next step for him: navigate to it.
When you duplicate a record, it´s mean that you are creating a new record using data from a existing record, there is no relations between those records.
You can ignore data from source record (it will be empty or null), but you can´t create e new relation or delete a records because you are creating a new one.
About This Community
|Asked: 11/20/19, 1:53 PM|
|Seen: 224 times|
|Last updated: 11/22/19, 11:47 AM|