Hope someone can helt with this. How can I make a rule to compare a new record beeing entered to an already existing record?
I've tried IF EXISTS .... WHERE (comparing some fields) THEN REPORT ERROR 'Duplicate row'
But there is no error thrown, so I'm obviously not catching duplicate values even though I enter the same value as the existing one for the fields I am trying to compare.. Maybe IF EXISTS is wrong? Any tips on what I can try instead?
Compare new record to existing record
-
- Posts: 2413
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Compare new record to existing record
Have a look at the Customer BO in the CRM Sample App....
In the Business Object Rules you will see this....
If EXISTS SystemUser WHERE (SystemUser.LoginName=ThisCustomer.LoginName AND SystemUser.ID<>ThisCustomer.ID) Then REPORT ERROR 'User with this login name already exists. Please choose a different name'
Notice it is checking the ID
In the Business Object Rules you will see this....
If EXISTS SystemUser WHERE (SystemUser.LoginName=ThisCustomer.LoginName AND SystemUser.ID<>ThisCustomer.ID) Then REPORT ERROR 'User with this login name already exists. Please choose a different name'
Notice it is checking the ID
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Re: Compare new record to existing record
Thanks! May I ask what This points to? Is it what the user is entering or the existing record? This/that confuses me
Also, to clearify: I want to allow the user to make a new row based on an existing row (use process for that), but do not want them to make a new row exactly like an existing. Everything (name, id and so forth) but the times (like monday from - to) and valid period should be the same. If there is already a schedual with from monday 08.00 til monday 20.00 within the same periode, I wan't to throw an error.
Also, to clearify: I want to allow the user to make a new row based on an existing row (use process for that), but do not want them to make a new row exactly like an existing. Everything (name, id and so forth) but the times (like monday from - to) and valid period should be the same. If there is already a schedual with from monday 08.00 til monday 20.00 within the same periode, I wan't to throw an error.
-
- Posts: 7526
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: Compare new record to existing record
"This" is to distinguish existing customers from the current customer being added to the system.
Aware IM Support Team