Basic question.... Form<->SubForm

abartonicek
Member Posts: 162
I have Header table and Lines table.
I have form from Header table with subform from Lines table.
Classic, wright.
The PK in Header table is DocNo.
The PK in Lines table is DocNo.,LineNo.
Form to subform link is DocNo.=FIELD(DocNo.)
How(and where and in what trigger) to auto fill subform DocNo. increment LineNo.
I used DocNo := GETFILTER(DocNo.) in OnNewRecord but I'm getting wierd results so.. :?:
Help.
I have form from Header table with subform from Lines table.
Classic, wright.
The PK in Header table is DocNo.
The PK in Lines table is DocNo.,LineNo.
Form to subform link is DocNo.=FIELD(DocNo.)
How(and where and in what trigger) to auto fill subform DocNo. increment LineNo.
I used DocNo := GETFILTER(DocNo.) in OnNewRecord but I'm getting wierd results so.. :?:
Help.
Better to be critical then self-critical 

0
Answers
-
You need to activite the autosplitkey property on the subform.
PS.
I hope the fieldname is Document No. and not DocNo
Please follow the Navision guidlines....0 -
Doesn't work :?:
SubForm:
Autosplitkey is ONDocNo. :=GETFILTER(DocNo.) in OnNewRecord
The DocNo doesn't get filled and the record is filltered out from subform.
When the code is in OnAfterGetRecord then the field is filled but the form is acting funny, filling all lines in subform and when I want to change something I get error that that LineNo allready exists.
PS.
DocNo is just for this posts.Better to be critical then self-critical0 -
Once you have set the subform link to Document No. and AutoSplitKey is enabled on the SubForm, You Do NOT need any codes to create the Line Numbers and Document Numbers.
It will be automatically Done.
Try Removing your codes.Sunday, Godwin G0 -
Yes, try to remove the code and if there is any, the tableview in the subform.0
-
Works =D>
Realy didn't know that, thx.Better to be critical then self-critical0 -
All you need is:
Header table PK = DocNo
Line table PK is DocNo, LineNo (must be integer type!)
Form with source table Header, and a form with source table line, don't think about subform yet. Set the Autosplitkey property of your line form to yes.
On your header form, create subform control and set the form id to the line form. In the formlink property you set the filter on Header.DocNo = FILTER(Line.DocNo).
This should take care of the auto numbering. There is no need for ANY coding at all.0 -
-
Double posting AND one minute to late
But intentions were great. =D>0 -
-
DenSter wrote:All you need is:
Header table PK = DocNo
Line table PK is DocNo, LineNo (must be integer type!)
The last field in the primary field must be an integer BigInteger, GUID or decimal field. If these conditions are met, you can set Autosplit key property to Yes.With Regards,
Shilpa Reddy0 -
DenSter wrote:All you need is:
Header table PK = DocNo
Line table PK is DocNo, LineNo (must be integer type!)
The last field in the primary field must be an integer BigInteger, GUID or decimal field. If these conditions are met, you can set Autosplit key property to YesWith Regards,
Shilpa Reddy0
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