4 Replies Latest reply on Feb 9, 2007 5:31 AM by siriiven

    Need help catching duplicates from csv import

    siriiven Level 1
      I have a page where a user can import a csv file. I want to check for duplicates and either disregard them and only use the number once or delete the duplicates. Here is my code:

      <cffile action="read" file="#form.FiletoUpload#" variable="csvfile">
      <cfloop index="index" list="#csvfile#" delimiters="#chr(10)##chr(13)#">


      <cfquery name="massimport1" datasource="#bads#">
      INSERT INTO table1(ID, RID, Level, Schedule, Date1,Date2)
      VALUES ('#listgetAt('#index#',1, ',')#', '#id#', '#form.Level#', '#form.Schedule#', '#form.date1#', '#form.date2#')
      </cfquery>

      </cfloop>

      Is there any way to eliminate duplicate ID numbers entered at that step? Any ideas would be appreciated.