Number Series Generation

vipinkuruvilla
Member Posts: 143
Hai,
Can anyone tell me how I can generate number sereies ? I like to get some codes for the same. I have already added the necessary fields in the Sales & Recievables Setup screen and table . Only my code is not working. I dont have any document type as it is there in Sales Header. So Iam a bit confused.
Any help would be appreciated.......
Can anyone tell me how I can generate number sereies ? I like to get some codes for the same. I have already added the necessary fields in the Sales & Recievables Setup screen and table . Only my code is not working. I dont have any document type as it is there in Sales Header. So Iam a bit confused.
Any help would be appreciated.......
0
Comments
-
I am not sure if I get You well. You want to have an serial code, which will auto increment (like sales invoice No. does)?
"Labour Contract Series No." is a code of 10, with Table Relation property set to "No. Series".Code... IF PayrollAndHumanResSetup.FIND('-') THEN BEGIN PayrollAndHumanResSetup.TESTFIELD("Labour Contract Series No."); employeeContract."No." :=NoSeriesManagement.GetNextNo(PayrollAndHumanResSetup."Labour Contract Series No.", WORKDATE, TRUE); END ELSE ERROR(text001); ...
NoSeriesManagement is an CU of the same name.
NoSeriesManagement.GetNextNo(
Your Series Code,
Date (this date is going to be saved as the date of last assigned No.),
dose it have to save the number as used (IF No then this number is still able to be taken.) );
I hope it will help You.0 -
Try to copy/use code from Customer table for example. There is One field in Primary key.
OnInsert:IF "No." = '' THEN BEGIN SalesSetup.GET; SalesSetup.TESTFIELD("Customer Nos."); NoSeriesMgt.InitSeries(SalesSetup."Customer Nos.",xRec."No. Series",0D,"No.","No. Series"); END;
OnValidate-No.IF "No." <> xRec."No." THEN BEGIN SalesSetup.GET; NoSeriesMgt.TestManual(SalesSetup."Customer Nos."); "No. Series" := ''; END;
You must just change "customer Nos." on your New Nos.0 -
JedrzejT wrote:Try to copy/use code from Customer table for example. There is One field in Primary key.
OnInsert:IF "No." = '' THEN BEGIN SalesSetup.GET; SalesSetup.TESTFIELD("Customer Nos."); NoSeriesMgt.InitSeries(SalesSetup."Customer Nos.",xRec."No. Series",0D,"No.","No. Series"); END;
OnValidate-No.IF "No." <> xRec."No." THEN BEGIN SalesSetup.GET; NoSeriesMgt.TestManual(SalesSetup."Customer Nos."); "No. Series" := ''; END;
You must just change "customer Nos." on your New Nos.
From where i will get this "No.Series" ?? Do I have to add another field in my table with a lookup to the sales & Recievables setup? Please do advice.....0 -
You must have field
1.
"No. Series" Code 10 with tablerelation to table "No. series" in Your table which have to be numbered.
2.
"New Table Nos." code 10 with tablerelation to table "No. series" in setup table.
Use "new table Nos." instead "customer Nos.". That's all if you have table with one field primary key.0 -
JedrzejT wrote:You must have field
1.
"No. Series" Code 10 with tablerelation to table "No. series" in Your table which have to be numbered.
2.
"New Table Nos." code 10 with tablerelation to table "No. series" in setup table.
Use "new table Nos." instead "customer Nos.". That's all if you have table with one field primary key.
I have implemented everything as per the instructions . The number is getting incremented but it is not getting displayed in the field. Do u know wht is the issue?? Do I have to write any code in AssistEdit().0 -
You can write some code in assist edit for choosing diffrent Nos. but this is not the reason you don't see number in field.
You know the number is incremented but You dont see it? :-k
You look at value of "No." field?
Do you write code in table? or in form?
I can help You if You Paste Your code and what is the primary key of your table.0 -
JedrzejT wrote:You can write some code in assist edit for choosing diffrent Nos. but this is not the reason you don't see number in field.
You know the number is incremented but You dont see it? :-k
You look at value of "No." field?
Do you write code in table? or in form?
I can help You if You Paste Your code and what is the primary key of your table.
My Primary Key is No I have written my code in table. My code looks like below :
OnInsert() :
IF No = '' THEN BEGIN
SalesSetup.GET;
SalesSetup.TESTFIELD(TomNo);
NoSeriesMgt.InitSeries(SalesSetup.TomNo,xRec."No.Series",0D,No,"No.Series");
END;
No - OnValidate() :
IF No <> xRec.No THEN BEGIN
TomSetup.GET;
NoSeriesMgt.TestManual(TomSetup.TomNo);
END;
This is what I have written. "No.Series" have implemented as per your instructions. Iam not sure what I have to write it in AssistEdit(). TomNo is the name I have given in the Sales & Recievables Setup.
AssistEdit():
WITH RecHeader DO BEGIN
COPY(Rec);
SalesSetup.GET;
IF NoSeriesMgt.SelectSeries(SalesSetup.TomNo,OldRecHeader.No,No) THEN BEGIN
NoSeriesMgt.SetSeries(No);
END;
In the above code RecHeader is the record variable of my table where the number series should be implemented. To be frank OldRecHeader I just duplicated the same after going through sales Header number series code. Iam not sure about this.
Also I have written the following code in my Header form :
No - OnAssitEdit() :
IF AssistEdit(xRec) THEN
CurrForm.UPDATE;
Hope you can rectify my mistakes. Thanks in advance......
END;0 -
Code with assist should be like:
AssistEdit(OldRecHeader : Record YourTable) : Boolean WITH RecHeader DO BEGIN COPY(Rec); SalesSetup.GET IF NoSeriesMgt.SelectSeries(SalesSetup.TomNo,OldRecHeader.No,No) THEN BEGIN NoSeriesMgt.SetSeries(No); Rec := Cust; EXIT(TRUE); END; END; No - OnValidate() : IF No <> xRec.No THEN BEGIN TomSetup.GET; NoSeriesMgt.TestManual(TomSetup.TomNo); "No. Series" := ''; END;
Code in insert and validate is good. Should work.0 -
JedrzejT wrote:Code with assist should be like:
AssistEdit(OldRecHeader : Record YourTable) : Boolean WITH RecHeader DO BEGIN COPY(Rec); SalesSetup.GET IF NoSeriesMgt.SelectSeries(SalesSetup.TomNo,OldRecHeader.No,No) THEN BEGIN NoSeriesMgt.SetSeries(No); Rec := Cust; EXIT(TRUE); END; END; No - OnValidate() : IF No <> xRec.No THEN BEGIN TomSetup.GET; NoSeriesMgt.TestManual(TomSetup.TomNo); "No. Series" := ''; END;
Code in insert and validate is good. Should work.
Thanx a lot dude. Its working fine. Thanx again for your valuable time.0 -
s0
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