Dataport - assign the next available number

shaneshane Member Posts: 20
I’m working through importing data into Navision 4.0 SP1 using the dataport functionality. I have run into one problem that I can’t seem to find an answer to after searching the forms and reading the Application Designer’s Guide. Perhaps I just missed it….

Regardless, here is my problem:

I have the Item Card setup to automatically assign the next available number for item numbers. I wish to import records from an Excel spreadsheet and have Navision assign the Item Number “No.”.

I have set the “AutoSave” and “AutoUpdate” to “No” for the Dataport and I assume that I now need to add some code to one of the triggers to facilitate the Item Number increment, and then trigger the insert. This is where I am a little lost.

Any advice would be greatly appreciated.

Comments

  • lzrlzr Member Posts: 264
    itemTmp."No." := '';
    itemTmp.insert(true);
    itemTmp.Description := item.Description;
    <etc>
    itemTmp.modify(true);

    This will use the default template (usually 999999) and generate a number for you

    and set autosave and autoupdate to false
    Navision developer
  • shaneshane Member Posts: 20
    Thank you. This works, I added the suggested code to the “OnAfterImportRecord()” trigger and had to create a local Variable called “itemTmp” of DataType “Record” and SubType “Item”.

    Not sure if this is all correct… I still have a lot to lean. But like I said, it works. Thanks again.
  • lzrlzr Member Posts: 264
    it is correct! :D
    Navision developer
  • ShenpenShenpen Member Posts: 386
    Actually, if the No. Series is configured to be automatic (default checked, manual unchecked) and you insert with a blank No. it should get a new number automatically, without coding...

    Do It Yourself is they key. Standard code might work - your code surely works.
Sign In or Register to comment.