Increment Number Series When Report Runs

erugalatha
Member Posts: 120
Hi,
I have a report which generates a file. In this file I need a unique file number identifier. I've decided to set up a No. Series for this file numbering but how do I get the new number from the No. Series into my file generated by the report? I do not know how to link report to no. series (maybe it does not work this way)
Thanks for your help.
I have a report which generates a file. In this file I need a unique file number identifier. I've decided to set up a No. Series for this file numbering but how do I get the new number from the No. Series into my file generated by the report? I do not know how to link report to no. series (maybe it does not work this way)
Thanks for your help.
0
Comments
-
Put this in the report to get a unique no.
NoSeriesMgt.InitSeries(recSomeSetup."REPORTNOS",recSomeSetup."REPORTNOS",0D,codTheNumber,recSomeSetup."REPORTNOS");
-recSomeSetup."REPORTNOS" should contain the no. series you want to use.
-codTheNumber : this will contain the newly generated no. from the no. series.
IMPORTANT: after calling this function, the table of the no. series will be blocked. So call this function as late as possible. After calling it, you should put a COMMIT to free the table again. But remember if after the COMMIT, there is some crash, the number will be used (or you have to put it back manually), even if your report hasn't finished yet.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
GetNextNo(TryNoSeriesCode,TrySeriesDate,TRUE);
From the same codeunit is even shorter.0 -
Great ... got that part working using Mark's way. Thank you.
I've now run into another issue where the file is a daily file with a three digit file number (i.e. 001 to 999 files per day).
Is there a way to reset the file numbering no. series on a daily basis?
Or should I not use no. series at all e.g. create my own table and create a record for each days files?
Thank you for your help.0 -
You can remove the field Last No. Used from the No. Series Line [309] table. This resets the number series.
Be carefull not to clear the wrong one.0 -
You can also add 2 fields in some setup table (General Ledger Setup or other) : an integer for the counter and a date for the date when it was last updated.
Then when you need a number you just check if the date in that table is today. If it isn't put the counter back to 0.
Then add 1 to the counter, save the record. And you have a new number.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions