Hello everyone ,
Let's consider an example where I input the first name 'A' and the last name 'B' for the first employee. Now, if the second employee shares the same first and last names, upon clicking the 'Save' button, a popup will appear. This popup will inquire whether this new employee is the same as the first one. If I confirm that they are the same ('Yes'), the new employee won't be added. However, if I indicate that they are not the same ('No'), the new employee will be added.
Is there any solution?
Hi saadouni rafika,
As your requirement, I create an oml. Please check it, hope it help you.
Test URL :Testing for duplication in the database
Thank you, sir. Your oml has helped me identify my issue
Hey Saadouni Rafika,
Attaching a new one this will work.
Thanks & Regards,
Sudip Pal
Hi @saadouni rafika ,
I don't know what you want to achieve, but it's definitely possible to have 2 records in database with same attributes FirstName and LastName, as long as the primary key (let's call it 'Id' for example's sake) is different. So if you have a table/entity called Employee with following attributes: Id, FirstName, LastName, you can have 2 records on database like this:
Id FirstName LastName
23 Paulo Ritto
25 Paulo Ritto
So in your logic you should have an aggregate where you check for any records with same Names as you are trying to insert, and if statement to check if there is any or not (.Empty property). If the aggregate returns a result that is NOT empty, you display a warning saying there's already someone with same name in DB, if the user clicks to not create, nothing should happen, if the user clicks to create, you should simply call the CreateEmployee CRUD action.
Let me know if this helped,
Paulo
Hello saadouni,
Hope you're doing well.
Your requisite seems to be quite simple, by the time you click in the "Save" button, you just need to execute a query to the database and check if there is already a record with the same first and last names.
What exactly is your issue with this implementation? What do you have done so far?
Kind regards,
Rui Barradas
Hi
It's very simple on the save button logic run query to database with filter first name or last name if data fetched by the query I mean it's not empty that means the user with the same first name or last name is already exist so you can end your save button logic before create record
Thanks
Arun
I am attaching an OML .Please check and let me know if you face any problem .
Hi Sudip,
The condition doesn't work; it always saves the same employees.