Pass value from form (header) to subform (lines)

mysamza
Member Posts: 66
I have a Header table;
and a Line table;
and a Header page;
and a Subform;
I am trying to move the Production Number that gets filled up on the Header to the Lines. So when a new document is created, let's say with Production No. = 100, for the line items selected, for every line I would like to save 100 as well. I can get this moved from Header to Line if I keep Production No. as my Primary Key. And my case does not allow that, because for every header with production no 100 I can have multiple Lines posted. Hence I made Entry No as a kind of Document No for my table and increment it by 1 every time a new record is created to make sure it is unique.
Inshort, how do I get my Production No from header flow to my lines table?
Thanks a lot in advance for the help! I have seen 36 and 37 and could not figure it out.
table 50108 "Production Time Log Header" { DataClassification = ToBeClassified; fields { field(50000; "Entry No"; Integer) { DataClassification = CustomerContent; } field(50002; "Production No."; Code[20]) { DataClassification = ToBeClassified; } field(50003; "Total"; Decimal) { FieldClass = FlowField; CalcFormula = sum ("Production Time Log Lines"."Run Time" where("Production No." = field("Production No."))); } } keys { key(PK; "Entry No") { Clustered = true; } } var myInt: Integer; trigger OnInsert() var recPTLH: Record "Production Time Log Header"; begin Clear(recPTLH); IF recPTLH.FindLast() then "Entry No" := recPTLH."Entry No" + 1 else "Entry No" := 1; end; }
and a Line table;
table 50113 "Production Time Log Lines" { DataClassification = ToBeClassified; fields { field(50000; "Entry No"; Integer) { DataClassification = CustomerContent; } field(50001; "Line No."; Integer) { DataClassification = CustomerContent; Editable = false; } field(50002; "Production No."; Code[20]) { DataClassification = CustomerContent; // TableRelation = "Production Time Log Header"."Production No." where("Entry No" = field("Entry No")); // ValidateTableRelation = true; } field(50003; "Process"; Code[20]) { DataClassification = CustomerContent; TableRelation = "Work Center"; } field(50012; "Run Time"; Decimal) { DataClassification = CustomerContent; } } keys { key(PK; "Entry No", "Line No.") { Clustered = true; } key(T; "Run Time") { MaintainSqlIndex = false; MaintainSiftIndex = true; SumIndexFields = "Run Time"; } } var myInt: Integer; trigger OnInsert() begin end; }
and a Header page;
page 50111 "Production Time Log Card" { PageType = Document; ApplicationArea = All; UsageCategory = Administration; SourceTable = "Production Time Log Header"; RefreshOnActivate = true; layout { area(Content) { group(General) { field("Entry No"; "Entry No") { ApplicationArea = All; } field("Production No."; "Production No.") { ApplicationArea = All; TableRelation = "Production Order"."No."; } field(Total; Total) { ApplicationArea = All; } } part(Line; "Production Time Log Subform") { Visible = true; ShowFilter = true; UpdatePropagation = Both; SubPageLink = "Entry No" = field("Entry No"); } } } }
and a Subform;
page 50112 "Production Time Log Subform" { PageType = ListPart; ApplicationArea = All; UsageCategory = Administration; SourceTable = "Production Time Log Lines"; AutoSplitKey = true; DelayedInsert = true; MultipleNewLines = true; layout { area(Content) { repeater(Line) { field(Process; Process) { ApplicationArea = All; } field(Runtime; Runtime) { ApplicationArea = All; } } } } } }
I am trying to move the Production Number that gets filled up on the Header to the Lines. So when a new document is created, let's say with Production No. = 100, for the line items selected, for every line I would like to save 100 as well. I can get this moved from Header to Line if I keep Production No. as my Primary Key. And my case does not allow that, because for every header with production no 100 I can have multiple Lines posted. Hence I made Entry No as a kind of Document No for my table and increment it by 1 every time a new record is created to make sure it is unique.
Inshort, how do I get my Production No from header flow to my lines table?
Thanks a lot in advance for the help! I have seen 36 and 37 and could not figure it out.
0
Answers
-
If you don't need to change "Production No." on individual lines at any point (always same as header), you could make it into a FlowField on the lines. Something along the lines of
FieldClass = FlowField; CalcFormula = Lookup("Production Time Log Header"."Production No." WHERE (Entry No.=FIELD(Entry No.))); Editable = false;
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