AutoIncrement
 
            
                
                    omyvadiya                
                
                    Member Posts: 124                
            
                        
            
                    Hi,
I have a No. field that must be incremented everytime whenever data is inserted. I follow the link below to increment. But couldn't even find a value in the field.
http://blogs.msdn.com/b/nav/archive/201 ... entmessage
                I have a No. field that must be incremented everytime whenever data is inserted. I follow the link below to increment. But couldn't even find a value in the field.
http://blogs.msdn.com/b/nav/archive/201 ... entmessage
0                
            Comments
- 
            Can you share the code you have written because the code referred in the blog works perfectly.CA Sandeep Singla
 http://ssdynamics.co.in0
- 
            Actually the scenario is that i have to copy order lines of 1st sales order
 and then from the 2nd sales order to the third Sales Order. So i have created
 the Line No. to get a sequence like 10,20,30....and so on
 I have created 2 new fields in table:
 1. Line No. (that i want to increment)
 2. No. Series (Table Relation - "No. Series")
 As per the blog i wrote following code:
 1. Line No. - OnValidate
 IF "Line No." <> xRec."Line No." THEN BEGIN
 SalesSetup.GET;
 NoSeriesMgt.TestManual(SalesSetup."Prod. Order Routing Line No");
 "No. Series" := '';
 END;
 2. OnInsert() Trigger:
 IF "Line No." = 0 THEN BEGIN
 SalesSetup.GET;
 SalesSetup.TESTFIELD("Prod. Order Routing Line No");
 NoSeriesMgt.InitSeries(SalesSetup."Prod. Order Routing Line No",xRec."No. Series",0D,"Routing No.","No. Series");
 END;
 3. AssistEdit()
 WITH recProdOrRouLine DO BEGIN
 recProdOrRouLine := Rec;
 SalesSetup.GET;
 SalesSetup.TESTFIELD(SalesSetup."Prod. Order Routing Line No");
 IF NoSeriesMgt.SelectSeries(SalesSetup."Prod. Order Routing Line No",OldrecProdOrRouLine."No. Series","No. Series") THEN BEGIN
 NoSeriesMgt.SetSeries("No.");
 Rec := recProdOrRouLine;
 EXIT(TRUE);
 END;
 END;0
- 
            First; No. Seriers are used for Code 20 fields only. "Line No." is an integer field.
 If you want to increment "Line No." in code you can look at http://www.dynamics.is/?p=248 and use
 IF "Line No." = 0 THEN
 "Line No." := NextLineNo;
 where NextLineNo is a function similar to the example on my blog.________________________________
 Gunnar Gestsson
 Microsoft Certified IT Professional
 Dynamics NAV MVP
 http://www.dynamics.is
 http://Objects4NAV.com0
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
- 322 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

