Sales Line creating new lines and assigning new line no.
dimitris
Member Posts: 17
Hallo Everybody
I have a problem in the sales line table. I wrote some code in form 46 (Sales Order Subform) that does the following: If the type is item and the item no exists in a custom table that i created then i would like to automatic insert some new lines in the Sales Line table, the number of lines depends on how many times the item no. exists in the custom table. Every new line stands for a new item with a specific amount of quantity and a value. My problem has to do with the Line No. of Sales Line. As I observed the line no. is zero until you fill the Quantity field then it increments by 10000. Where can I find the piece of code that does this? I incremented every new line by 10000 in order to insert my new lines, but I do not know what to do if someone puts a record between 2 existing lines (e.g 10000 and 20000) the new line no becomes 15000. then i can not increment by 10000 because it would destroy my order. Any ideas?
Also i noticed that sometimes i need to change to the next record in order to the line no to be assigned a new number. That makes things more complicated.
I would appreciate any help
I have a problem in the sales line table. I wrote some code in form 46 (Sales Order Subform) that does the following: If the type is item and the item no exists in a custom table that i created then i would like to automatic insert some new lines in the Sales Line table, the number of lines depends on how many times the item no. exists in the custom table. Every new line stands for a new item with a specific amount of quantity and a value. My problem has to do with the Line No. of Sales Line. As I observed the line no. is zero until you fill the Quantity field then it increments by 10000. Where can I find the piece of code that does this? I incremented every new line by 10000 in order to insert my new lines, but I do not know what to do if someone puts a record between 2 existing lines (e.g 10000 and 20000) the new line no becomes 15000. then i can not increment by 10000 because it would destroy my order. Any ideas?
Also i noticed that sometimes i need to change to the next record in order to the line no to be assigned a new number. That makes things more complicated.
I would appreciate any help
0
Comments
-
look at how the item's extended text works0
-
It's not code, it's the AutoSplitKey property of the form itself... yeah, really, not joking, I was quite surprised when I found it

Just number your lines by 10000 and when users insert new records the form with automagically halve the key each time (like, 15000, 12250, and so on).0 -
changing the autosplitkey property to no, whenever a new record is inserted the line no remains 0, which creates an error. not good I suppose. What do you mean by saying the item's extended text?0
-
But why do you want to change it? It works so that you generate the lines and the user can insert lines before, after, or within your lines. What do you want to do? Disallow inserting within your lines or what?0
-
Not a good idea to change this property.
Extended text is a functionnality you will find in the Menu of Item Card.
It permits to automatically add lines of text in document.0 -
Anyway, I think you give a new Line No. from the OnInsert trigger (FIND(+)-ing the last record and increasing it) if you really want, but I don't really understand what you are trying to accomplish.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions