How to Check if a Line has changed within a Header Table
SMGNav
Member Posts: 4
Hello there! I am new to Nav and would appreciate some help here.
So, I have a HEADER Table with a boolean - "Record Modified"
This field is non editable and changes based on printing a report.
If a record is modified after printing a report the box is checked.
I have this working by setting the boolean to true in the Header Table OnModify() function.
This Header Table also has a Line table and I'm trying to set this boolean to TRUE if a record in the LINE table is changed.
I have tried putting this code in the Line table OnModify():
HeaderTableRec.GET( No. )
HeaderTableRec."Record Modified" := TRUE
HeaderTableRec.MODIFY
but the check box does not change. I'm not sure if I'm missing how the tables are related or I'm referencing the Header table the wrong way
So, I have a HEADER Table with a boolean - "Record Modified"
This field is non editable and changes based on printing a report.
If a record is modified after printing a report the box is checked.
I have this working by setting the boolean to true in the Header Table OnModify() function.
This Header Table also has a Line table and I'm trying to set this boolean to TRUE if a record in the LINE table is changed.
I have tried putting this code in the Line table OnModify():
HeaderTableRec.GET( No. )
HeaderTableRec."Record Modified" := TRUE
HeaderTableRec.MODIFY
but the check box does not change. I'm not sure if I'm missing how the tables are related or I'm referencing the Header table the wrong way
0
Best Answer
-
Code seems correct...
is "No." the only field in the primary key of the HeaderTableRec?
For example, Sales Header and Purchase Header have "Document Type" and "No." as primary key, so you'd need to use both in the GET.
6
Answers
-
Since it is working on your header why can't you write something in your line table like
IF HeaderTableRec."Record Modified" = TRUE THEN "Record Modified" = TRUE;
0 -
Hi SMGNav
Your code looks correct. Make sure the OnModify trigger of the line is actually called.1 -
Code seems correct...
is "No." the only field in the primary key of the HeaderTableRec?
For example, Sales Header and Purchase Header have "Document Type" and "No." as primary key, so you'd need to use both in the GET.
6 -
Thank you for your replies! I was missing a key as Resolus suggested.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
