This topic is locked

How To Avoid Duplicate Record Entry In A Detail Table

5/22/2013 12:06:42 AM
PHPRunner General questions
romaldus author

How to avoid duplicate record entry in a detail table? For example i want to add 100 items (or more) in order details, how can I ensure that no items are inputted twice?
In the schreenshot : item inputed twice.
Screenshot :

C
cgphp 5/22/2013
romaldus author 5/22/2013



Check this article from the manual: http://xlinesoft.com...cord_exists.htm


Thanks christian, i didn't mean duplicate record in database, but duplicate entry in add form .

On the screenshot above, my customer made a mistake. He added the same product twice in order form.

C
cgphp 5/22/2013

I'm not sure I understand your request. A duplicated entry on the add form will be tapped as a duplicated record in the database.

L
lakanol 5/22/2013

Is that you don't want to have duplicate value in the view showing?

try use mysql 'group by' for the page showing.

romaldus author 5/23/2013

This is something like Form Validation in add form.
what I want is : when a customer accidentally enters the same product (which has been added to the previous field) , an alert box will appear .... ""..
screenshot :

C
cgphp 5/23/2013

As I said in my previous message, check for existing record (http://xlinesoft.com/phprunner/docs/check_if_specific_record_exists.htm) and when you save all, the duplicate record will throw an error.

Sergey Kornilov admin 5/23/2013

Cristian is correct, use BeforeAdd event to check for duplicates and display the message.
Another option is to check for duplicates in BeforeAdd and simply ignore the duplicate record.