Field Property in Dataport

Hi, I have to create an import-dataport, where in some cases (Var.Change := False) some fields in the article-record (description) should not be changed. I could not found a solution, to vary the enabled-property dynamically. Michael

A solution may be to put some code in the trigger “OnBeforeImportRecord” to save the old values of the fields that may not change, and some code to restore these old values in the trigger “OnAfterImportRecord” depending of the value of Var.Change.

Michael, look at the AutoSave and AutoUpdate properties of your data item. The help has an unusually clear definition, look there first. :slight_smile: Then, depending on your parameter you could shoot out an INSERT or a MODIFY at the end of “OnAfterImport” trigger, based on whether a record exists or not.

way of doing those kind of things: Autosave property = false; OnAfterImportRecord event modify it for getting all the values you want to store and then insert/modify the record. You can use an auxiliar variable for trying to get the original one and then allow or not to change certain fields. Example: suppose you’re importing item records: dataitems item DTItem Global variable: auxitem Record (27) Item DataportFields: No. Description1 Description2 onAfterImportRecord CLEAR (AuxItem); AuxItem.RESET; IF (AuxItem.GET(DTItem.“No.”)) THEN BEGIN IF (DTItem.“Description2” <>‘TEST’) THEN BEGIN // We’ll modify description 1 only if the description 2 is not test AuxItem.VALIDATE(“Description1” ,DTItem.“Description1”); AuxItem.VALIDATE(“Description2” ,DTItem.“Description2”); AuxItem.MODIFY(TRUE); END ELSE BEGIN // We’ll modify only description 2 if the description 2 is test AuxItem.VALIDATE(“Description2” ,DTItem.“Description2”); AuxItem.MODIFY(TRUE); END; END ELSE BEGIN // It’s a new record… then insert. DTItem.INSERT(TRUE); END; Alfonso Pertierra (Spain)apertierra@teleline.es