Newbie... Designing a Dataport

Hi,

im new to developing Objects in Dynamics.
I’m not sure if my post belongs here, if not please let me know.

My current problem:

I started to design an import- dataport. After the data is imported, i would like to chance a Boolean-Field in the table to TRUE.
I created a record variable for the specific table, and in the OnAfterImportRecord-Trigger i set the Boolean to TRUE and add a MODIFY.

Like this:
ErfSnpRec.Booleanfield := TRUE;
ErfSnpRec.MODIFY;

After executing the dataport, i get the following error:

ErfSnp No ‘’ doesn’t exist.

To explain: I import Data for 5 table-fields. One of those 5 fields is the primary table key (No).
So thats why the MODIFY fails.

Any other way to do this?

regards

Just

Booleanfield := TRUE;
MODIFY;

on the OnAfterImportRecord-Trigger should do the trick.

There is no need for the record variable “ErfSnpRec” in this case. Of course you could use your record variable. But then you have to find you record you just imported first and do your modification then.

Hello !

I have problem with my Dataport. I have .txt file and I created table Import Buffer with two fields: Line No. and Line Text. All I want to do is import one line as one record in my table. Line No. has property AutoIncrement set Yes, because I want to have lines numered.

I created new Dataport, chose my table (Import Buffer) and I chose Line Text in Dataport Fields with StartPos 0 and Width 0. When I run this data import all what is imported is the last line. Does anyone know why ?

Hello,

nice idea with the AutoIncrement but that won’t work here.

If your ImportBuffer-Table is always empty before import, a “Line No.” := “Line No.” + 1 on the OnBeforeImportRecord-Trigger will do.

If your ImportBuffer is not empty, find the last “Line No.” first and the increment on the trigger. Hope that helps.

Kind regards

Walter

Thanks Walter, you’re right AutoIncrement doesn’t work. Your idea does. THANKS !