get Automatically No. when import data with dataport

elToritoelTorito Member Posts: 191
edited 2005-01-12 in Navision Financials
Hi,

what and where must i code if i like make a dataport that takes the last no. from one No. Serie and give this new No. the Data what i wan't import.

Thanks.
(Oo)=*=(oO)

Comments

  • fbfb Member Posts: 246
    Start by defining a global variable 'NoSeriesMgt' referring to Codeunit 396. Then, in the OnAfterImportRecord trigger, use the following code (with suitable replacements -- "No." is the field to get the new number, 'XXXX' is the No. Series to use):
    "No." := NoSeriesMgt.GetNextNo('XXXX',0D,FALSE);
    
    The FALSE parameter is a trick to delay locking the No. Series Line table -- the NoSeriesMgt codeunit reads the No. Series Line record once on the first call, and then hands out the next number from the series for each subsequent call, but does NOT update the No. Series Line.

    Therefore, to update the No. Series Line at the end of the Dataport, you have to code the following in the OnPostDataItem trigger:
    NoSeriesMgt.SaveNoSeries();
    
  • elToritoelTorito Member Posts: 191
    Hi,

    Thanks you very much, i musted search i little in the 396 Codeunit because the Functions are Named different , but now it works.

    regards

    Petter
    (Oo)=*=(oO)
  • lodgerlodger Member Posts: 16
    I used this code to populate the document no when dataporting in a Gen Jrnl but it gives a new number for every line and will not post as it is out of balance.

    Any suggestions to keep the same document number for every line in the journal.

    Thanks

    lodger
  • ArhontisArhontis Member Posts: 667
    You could get it once at the beggining of the dataport into a variable and use that var to give that same value to all the recs.

    Or you need something else? :-k
  • lodgerlodger Member Posts: 16
    Didn't need anything else... that worked great!

    Thanks Arhontis

    lodger
Sign In or Register to comment.