Check for duplicates in uploaded excel data

Check for duplicates in uploaded excel data

  
Hi Everyone,

I am trying to import data from excel to database. My requirement is, when a user uploads an excel then I need to validate all the records for mandatory and unique(email) checks, if any record fails the validation then need to stop the process and should display that error to the user.  If all records pass validation then only need to insert in database.

I need to check if there exists any duplicate email with in the excel file. (i.e., excel having 2 records with same emailid's)

To achive this,
1) convert excel to record list1
2) foreach record list 1 ---> once again take foreach for record list1 and check .

This is how i am thinking to achieve, Is there any better way of doing this?
Please suggest.

Thanks
Salini


Hi Salini,

You aproach will work and it's the straightforward approach, nevertheless please consider using one Hashtable to store the unique value as a key.

http://www.outsystems.com/forge/component/21/hashtable/

This will improve performance, specially if the nr of records to check are considerable.

Best Regards.

There's also the system component TextDictionary, that does the same thing (and I'd prefer since it's a system component and needs no additional components).
Nice tip Kilian!
Thanks. I think it was added in version 8, but it could be a version 9 thing.
Thanks Daniel and Kilian for your suggestions.