AnsweredAssumed Answered

Importing: Avoiding duplicate records

Question asked by tays01s on Oct 11, 2017
Latest reply on Mar 29, 2018 by philmodjunk

I have been using an Import script without problems for some months but suddenly ended up with duplicate records. The problem appears to be that the records are imported from files within a specified folder. I think I forgot to delete previous import files prior to adding another batch to this folder. I have just obtain duplication by doing this.

 

Script:

 

#set path

Set Variable [ $path_im; Value:Global::Path_NSTools & "FC_import_files/" ]
#set vars
Set Variable [ $path_patient; Value:$path_im&"Export_patient.fmp12" ] 

Go to Layout [ “Patient_U” (Patient) ]

Import Records [ Source: “$path_patient”; Target: “Patient”; Method: Update matching; Add remaining; Character Set: “Mac Roman”; Field Mapping: Source field 1 import to Patient::__uuID

21 match with Patient::Health_ID

 

Go to Layout [ “Home_U” (Home) ]

Commit Records/Requests

 

2 Qs:

1. Even if I had the same records in 2 separate files, why didn't the "Method: Update matching; Add remaining;" notice there were already records present and prevent duplicates being added?

2. Since the specified import file being imported was "Export_patient.fmp12", why did the Export_patient.fmp12" affect import at all?

3. The script above is simplified. "Patient" is the parent table, but there are several child/grandchild etc tables. Deletion of a parent would normally remove children, but the duplicate parent will remain leaving duplicate children because the parent uuID matches their fk_uuIDs. Any good ideas on how to remove duplicates. My best so far was export to Excel, delete duplicates then import.

 

Outcomes