How to add new table to Navision auto numbering
 
            
                
                    brucem                
                
                    Member Posts: 86                
            
                        
            
                    Hi there,
I hve created a couple of table and would like to use the numbering methods as used by navision for things such as sales headers etc ( no series )
i have looked at the current tables, but am stuck as to the steps required to add them to the number series / auto numbering set up.
also i would like to use the rename record function / method to renumber the linekd sub table.
Any ans all help aprreciated
Bruce
                I hve created a couple of table and would like to use the numbering methods as used by navision for things such as sales headers etc ( no series )
i have looked at the current tables, but am stuck as to the steps required to add them to the number series / auto numbering set up.
also i would like to use the rename record function / method to renumber the linekd sub table.
Any ans all help aprreciated
Bruce
0                
            Comments
- 
            Bruce
 Adding No Series to a new "Widget" table
 Step 1
 One of the Setup Tables
 EG: 313: Inventory Setup
 Add a New Field
 50000 "Widget Nos." Type:Code Size:10 Properties:TableRelation = "No. Series"
 Step 2
 To your New Widget Table
 Add a New Field
 50000 "No Series." Type:Code Size:10 Properties:TableRelation = "No. Series"
 C/AL Globals
 Widget Type:Record SubType:Widget
 NoSeriesMgt Type:Codeunit SubType:NoSeriesManagement
 Copy AssistEdit Function from Item Table C/AL Globals
 Change Paramaters on the function to Widget Table
 Table Function:
 AssistEdit(OldWidget : Record Widget) : Boolean
 WITH Widget DO BEGIN
 Widget := Rec;
 InvtSetup.GET;
 InvtSetup.TESTFIELD("Widget Nos.");
 IF NoSeriesMgt.SelectSeries(InvtSetup."Widget Nos.",OldWidget ."No. Series","No. Series") THEN BEGIN
 InvtSetup.GET;
 InvtSetup.TESTFIELD("Widget Nos.");
 NoSeriesMgt.SetSeries("No.");
 Rec := Widget;
 EXIT(TRUE);
 END;
 Code as Follows (Copied from Item Table)
 Table Trigger:
 OnInsert()
 IF "No." = '' THEN BEGIN
 InvtSetup.GET;
 InvtSetup.TESTFIELD("Widget Nos.");
 NoSeriesMgt.InitSeries(InvtSetup."Widget Nos.",xRec."No. Series",0D,"No.","No. Series")
 END;
 Trigger:
 No. - OnValidate()
 IF "No." <> xRec."No." THEN BEGIN
 InvtSetup.GET;
 NoSeriesMgt.TestManual(InvtSetup."Widget Nos.");
 "No. Series" := '';
 END;
 Step 3
 Widget Card (Form)
 "No." Field TextBox C/AL Code
 OnAssistEdit()
 IF AssistEdit(xRec) THEN
 CurrForm.UPDATE;
 Have Fun
 MindSource(UK)Limited
 Navision Service Partner
 info@mindsource.co.uk
 www.mindsource.co.uk0
- 
            Grrrreeeat,
 thanks for that. Not quite the same as good old autonumber !!
 Bruce0
- 
            O.K.
 AutoNumbering Types 1 & 2
 Type 1
 New Table "My Table" with Primary Key "Entry No."
 C/AL Globals
 Var MyTable Type:Record SubType:"My Table"
 C/AL Code
 OnInsert ()
 MyTable.RESET;
 // Find Last Record
 IF MyTable.FIND('+')THEN
 "Entry No.":=MyTable."Entry No." + 1
 ELSE
 "Entry No.":=1;
 Type 2
 Table with Existing Multiple Fields in the Primary Key
 Table Named "My Table"
 New Field 50000 Name:"Entry No." Type:Integer
 New Key "Entry No."
 C/AL Global
 Var Name:MyTable Type:Record SubType:"My Table"
 C/AL Code
 OnInsert ()
 MyTable.RESET;
 MyTable.SETCURRENTKEY("Entry No.");
 // Find Last Record
 IF MyTable.FIND('+')THEN
 "Entry No.":=MyTable."Entry No." + 1
 ELSE
 "Entry No.":=1;
 Easy INIT!
 <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by brucem:
 Grrrreeeat,
 thanks for that. Not quite the same as good old autonumber !!
 Bruce<HR></BLOCKQUOTE>
 MindSource(UK)Limited
 Navision Service Partner
 info@mindsource.co.uk
 www.mindsource.co.uk0
- 
            Why not use the AutoSplitKey property of the form? This creates a new unique key for a new record at insert. Some conditions have to be met for the Key structure, but that's easy (see Help).
 Some AutoNumbering, after all :-)
 John0
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

