Dataport properties

Hello, I make a dataport wich should insert records from a txt file to a table. I want it to copy the records that doesn’t already exist in the database. I don’t want to change the records with the same primary key. So I use the property: autosave:yes ; autoupdate:no ; autoreplace : no but I get an error message The record already exist (I knew, thanks). How can I read the record in the txt file before to insert it in the table. I tried this but… read := (f.READ(“No.”)); Thank You, Vanina

Maybe you could check the DB for an existing Record in OnAfterImport and then skip this record …

IF VarRecord.GET(<Primary Key>) THEN

Or you can do it all manually: import the fields from the file NOT to Record.Fields but to variables. Then you can decide by code, whether to insert a record or not!

IF NOT VarRecord.GET(VarKeyField) THEN BEGIN
  VarRecord.<Primary Key> := VarKeyField;

Regards, Jörg

Thanks a lot, [8)] It works with OnAfterimport IF Varrecord.GET(“PrimaryKeyField”) THEN CurrDataport.SKIP ELSE INSERT; Varrecord.MODIFY; But I found strange to put the code there (OnAfterimport)

I think the following is easier : 1.) all auto…-options set to false 2.) in OnAfterImport : ok := insert; ok defined as global boolean