Dataport: how to access the No. Series?

Moin: I want to flood the Fixed Asset (5600) table via dataport. What is the most efficient way to get the next number for “No.” from the No.-Series table. In the following is a code snippet that shows my current solution - but I think there should be a more elegant way: “No. Series Line”.GET ( ‘FA’, 10000 ); SerialNr := “No. Series Line”.“Last No. Used”; SerialNr := INCSTR ( SerialNr ); “No. Series Line”.“Last No. Used” := SerialNr; “No. Series Line”.MODIFY; Regards Uwe

Hi Uwe, you’ll find the solution in the German forum. Torsten

If you wish to use the “No. Series” there is a function in the NoSeriesManagement Codeunit to GetNextNo. Example from Codeunit 80 “Shipping No.” := NoSeriesMgt.GetNextNo(“Shipping No. Series”,“Posting/Tax Point Date”,TRUE); Just pass the reference to the NumberSeries “Document No.” := NoSeriesMgt.GetNextNo(‘MYNOSERIES’,0D,TRUE); Let the System do the work! David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

“Document No.” := NoSeriesMgt.GetNextNo(‘MYNOSERIES’,0D,TRUE); Remeber that the TRUE part it that statement will cause the system to increase the Last Number used, but if you set it to false it will not. Thought you might just like to know

Hi Kolja There’s one: OnBeforeImportRecord(). FA.INIT; FA.INSERT(TRUE); and in Dataport Properties Autoreplace: true or in trigger OnAfterImportRecord() MODIFY(TRUE);

Are there anyother factors to consider on the OnInsert Trigger of the FA?

Moin: Thanks to all contributors. The winner is … Agustin! His solution comes extremely close to my imaginations :o) One additional question: > OnBeforeImportRecord(). > FA.INIT; > FA.INSERT(TRUE); According to NAVISION´s on-line help “INIT” should reset all fields in the current record to its zero-values. Astonishingly it does not in this case. Importing the second line, the INIT leaves “Nr.” intact, e.g. it still has the last value. Okay, that´s no tragedy, I set “Nr.” := ‘’; before INIT. Anybody out there with a good explanation for this behaviour? Regards Uwe Edited by - kolja on 2001 Apr 04 22:40:34

Uwe, have you read the help completely ? :wink: Comments The system does not initialize primary key fields. Bye, Torsten

Torsten: Shame on me! You are completely right! Should better read twice before posting. Good to see there´s always somebody on the watch :o) Regards Uwe