I have a bulk edit grid with multiple dropdown. I also have mysql unique constraint(safest way to handle duplicate).
Now once aware IM throws unique constraint error for duplicate as user selected same drop downs for product and customer and date for example(unique key set for product and customer and date) how do I remove a row after error is thrown? Is there way in aware to handle mysql error and then handle it to remove row or customize that popup message that came from db?
handle mySQL unique constraint error and remove row
-
- Posts: 370
- Joined: Sat Apr 28, 2018 3:33 am
- Location: India
- Contact:
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: handle mySQL unique constraint error and remove row
IS there a reason why you haven't used a business rule to check uniqueness? That would handle AIM duplicates.swiftinitpvtltd wrote:I have a bulk edit grid with multiple dropdown. I also have mysql unique constraint(safest way to handle duplicate).
Now once aware IM throws unique constraint error for duplicate as user selected same drop downs for product and customer and date for example(unique key set for product and customer and date) how do I remove a row after error is thrown? Is there way in aware to handle mysql error and then handle it to remove row or customize that popup message that came from db?
IF EXISTS BO WHERE BO.attributeToBeChecked=ThisBO.attributeToBeChecked AND BO.ID <> ThisBO.ID THEN REPORT ERROR'This record exists already. Duplicates are not allowed'
Prevents it being written to the database and you don't have to trap MySQL errors.
-
- Posts: 370
- Joined: Sat Apr 28, 2018 3:33 am
- Location: India
- Contact:
Re: handle mySQL unique constraint error and remove row
Thanks for asking.
IF EXISTS BO WHERE BO.attributeToBeChecked=ThisBO.attributeToBeChecked AND BO.ID <> ThisBO.ID THEN REPORT ERROR'This record exists already. Duplicates are not allowed'
This somehow not working properly in Bulk edit with multiple dropdowns. It's because of this and that BO issue.
Once validated if you change the dropdown it still again invalidates may be because of this and that...
IF EXISTS BO WHERE BO.attributeToBeChecked=ThisBO.attributeToBeChecked AND BO.ID <> ThisBO.ID THEN REPORT ERROR'This record exists already. Duplicates are not allowed'
This somehow not working properly in Bulk edit with multiple dropdowns. It's because of this and that BO issue.
Once validated if you change the dropdown it still again invalidates may be because of this and that...