Importing new rows using Transform Map, but trying to ignore duplicates and updates

AndyMaier
Giga Contributor

4/18/14 ... I have updated my question because I misphrased it.   I created an Import Set and Transform Map trying to import new rows from an excel spreadsheet to a Security Access Table.   My goal is to only import new rows and not do any updates to existing rows.   I can get rows to insert, but I am having   problems with my onBefore script trying to check and skip/ignore duplicate rows.   If I find a match to the Target table records for u_name & u_func_access_display, I want to skip the record and not insert.  

 

transform map.jpg

 

 

This is my onBefore script:

//CHECK TO SEE IF RECORD ALREADY EXISTS IN THE LLB SECURITY ACCESS TABLE

//COMPARE WITH NAME AND FUNC ACCESS DISPLAY FIELDS

 

    var ast = new GlideRecord('u_llb_security_access');

    ast.addQuery('u_name',source.u_name);

    ast.addQuery('u_func_access_display',source.u_func_access_display);

 

    ast.query();

 

//IF RECORD ALREADY EXISTS SKIP THE RECORD AND GO TO THE NEXT

    if(ast.next()){

            ignore = true;

  }

 

My onBefore script does not skip/ignore any duplicate records.   Any ideas on what I am doing wrong?

Thanks,

Andy

13 REPLIES 13

AndyMaier
Giga Contributor

Yes, because I have inserted them the time before.   I use the same import excel file.   My hope was to get all the rows ignored because the rows were already inserted before.


What I mean is there are 16 rows in the file and there are only 8 unique?   But it sounds like you are just importing the same 8 rows each time.



I would clear scrutinize those 8 rows very thoroughly.   What it sounds like is happening is for some reason when the system uses the values to query the table that it is not finding the old ones because the values are off for some reason.   I have had this issue when the column sizes have not matched.   So like your name column is 40 chars in the import table but only 30 in the actual data table, something like that.


I bet its your func_access_desc column.   after looking at one of your screen shots I bet the Import table has a char column that is not the same size as the data table.


AndyMaier
Giga Contributor

Sound good.   Thanks again for all your help!