Problem In Dataport Import From Fixed Length File

JohnieG
JohnieG Member Posts: 56
Hi to all,
I am new in Navision and I am trying to create my first dataport in Navision 4 SP2.
I am trying to insert from a fixed length file some records to the Item table. The dataport has the AutoUpdate Property set to Yes in order to update items which are already inserted instead of overwritting them. My problem is that the Item No. field is constructed by two separated fields from the source file. I am importing these fields (ItemNo1 and ItemNo2) into some global text variables which later on are used to construct the new ItemNo. as follows:
Item."No." := ItemNo1 + ItemNo2;
If i place this code in the OnBeforeImportRecord trigger then the first inserted item has a null Item No. and the AutoUpdate property seems to work.
On the other hand, if i place it in the OnAfterImportRecord trigger, no matter how many records the file has i am only succeding in inserting the first one and the AutoUpdate property seems disabled.
What am I doing wrong? Is there any more code that needs to be added? Any suggestion is more than welcome!

Thanks in advance...
Always Look On The Bright Side Of Life...

Comments

  • Kowa
    Kowa Member Posts: 926
    Set AutoSave to "No", do all that needs to be done in the OnAfterImportTrigger and then insert ( or modify) the record manually at the end of this trigger.
    Kai Kowalewski
  • JohnieG
    JohnieG Member Posts: 56
    Thanks a lot! I think that this is the solution!
    Always Look On The Bright Side Of Life...