Duplicate Entry error when importing with changes.
Duplicate Entry error when importing with changes.
Mr Arslan Jawed
Posts: 9Questions: 6Answers: 1
Hello,
I get Duplicate Entry error when I re-import data with some changes. Is there any way to update the record if changed when importing.
Answers
Is this with Editor? I assume you have a unique key which is being imported again.
Colin
Yes, Is there any way to update the record when importing.
I'm going to dump code here - this is something we did for a customer a while back. It's doing what you want, with the unique key in column 22. When you import, if a record already exists, the script modifies it; if the record doesn't exist it creates a new one.
I won't explain much about it here, as our intention is to write a blog post describing this in the next month - but hopefully this will get you going in the right direction. The code is comment so should make sense.
and part 2:
Hi Colin,
Before posting a case (I am getting the following error message: Uncaught TypeError: table.column(...).data(...) is undefined), I was wondering if there was a plan to publish something on the update on upload.
As well would you have any code for delete on upload?
column().data()
is in the main DataTables library - so it would be worth checking your libraries to make sure they're loaded correctly, and also check thecolumn()
is able to return the column you're expecting (maybe the selector is incorrect so that's returningundefined
perhaps).We don't have any code examples for that. When would you expect the delete to kick in?
Colin
Hello Colin,
I used your code to check for duplicate entries when I import CSV and I get the below error
Can you help?
See thread here for follow up: https://datatables.net/forums/discussion/comment/215850#Comment_215850
Colin