Delete record if fieldA := fieldB
Hi,
is there a way to completely delete the current record if a formula field results in a specific value or equals another given field?
15 replies
-
delete this
is the code to delete current record
-
Gianluca
You can put the formula in your trigger after update in the field b
as you are asking for the form (record) to delete as soon as there is an exact match on A and B field then this works here .....
-
Thanks for your reply RoSoft_Steven Rooryck
I tried but I can't seem to make it work.
I'll explain more in details what I have tried, so maybe you can spot my mistake.
I have a table named People and I have five fields (LastName, FirstName, Sex, Birthplace, Birthdate) and the values in these fields are used to create a unique value (FiscalCode) calculated via formula in another field in the same table (People).
I thought to put the trigger after update in "Birthplace" (which gets populated last) so that if the newly calculated FiscalCode equals one already created, the record gets canceled.
This is the code I've used:
let xFC := FiscalCode; if (count(select People where FiscalCode = xFC) = 2) then delete this else Birthplace
I'm using the Mac App and actually I have some problems with Triggers after update in general: they seem so work in a random way (the same formula, in the same field type, sometimes works and sometimes not). Often I need to close and reopen the app to have the changes applied.
-
Hi Gianluca
The issue you have is that dialogue does not work in Trigger after update: It really needs to be used behind a button. The rest of the code was working for me.
Regards John
-
Gianluca Take away the dialogue and it works fine for me. That aside, I would not have the fiscal code held in a formula field. I would have the fiscal code held in a text field that is updated with a button, and have it check for duplicates at the same time.
Content aside
- 2 yrs agoLast active
- 15Replies
- 232Views
-
5
Following