Autosplitkey and delayed insert

Pieter_Govers
Member Posts: 6
I have a problem with the sales lines and a own created table.
The situation is as follow:
Order form (sales header and sales lines table)
- Default on the sales line subform the autosplitkey is true for "Line No." also the property "delayed insert" is default set to yes. (this must stay so because otherwise the focus goes to the subform)
- Now the problem is on the onvalidate trigger of the quantity, I must add some lines to a own created table and this table contains also the "document type", "document No.", "Line No." form the sales line table. But everytime i does this the line number is still on '0'. This is because the delayed insert, the record is'nt saved yet and there is no splitkey generated yet. How can i force (in code) to generate the splitkey to copie to my table?
Kind regards,
Pieter
The situation is as follow:
Order form (sales header and sales lines table)
- Default on the sales line subform the autosplitkey is true for "Line No." also the property "delayed insert" is default set to yes. (this must stay so because otherwise the focus goes to the subform)
- Now the problem is on the onvalidate trigger of the quantity, I must add some lines to a own created table and this table contains also the "document type", "document No.", "Line No." form the sales line table. But everytime i does this the line number is still on '0'. This is because the delayed insert, the record is'nt saved yet and there is no splitkey generated yet. How can i force (in code) to generate the splitkey to copie to my table?
Kind regards,
Pieter
0
Answers
-
Try moving your code to OnAfterValidate and issue a CurrForm.Update(TRUE) before it.0
-
`...and please let us know if this solved your problem
i'm very interested.
0 -
Check the functions which are adding dimensions to the line. It is same, the dimensions are written into another table and are connected through Line No., but they are added in OnValidate (for example on No. field). You can do it in same way.0
-
Problem solved!
I've created a function that run on the "Sales Line" table ("Oninsert", "OnModify" and "OnDelete" trigger) when "xRec.Quantity <> Rec.Quantity", in this function I run my code and is the "Line No." filled in.
Thanks0 -
Waldo wrote:And also see if "xRec.Quantity <> Rec.Quantity"
please can you tell me the mystery behind this "xrec<>rec",i have seen it used so many places!Regards,
GD0 -
It is not mystery, xrec is record before change (how it is now saved in DB), rec is actual record (with the modification) which you are going to save into DB.0
-
kine wrote:It is not mystery, xrec is record before change (how it is now saved in DB), rec is actual record (with the modification) which you are going to save into DB.
i know this ,i want to know at the database level,how does Navision actually do this comparison,does it use any buffers and where does it store them,the Technical details pleaseRegards,
GD0 -
It is actually a consequence of the versioning principle that NAV applies. It always has the version you read in cache to compare if it was changed.
C/SIDE makes this version available to you (it is not an extra database call).
You should do the comparison, to avoid to make unnecessary database calls.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