Add separation line in a report
Josetxo
Member Posts: 92
Hello all,
first of all, I'd like to make you know that I am new in Navision development... and in development in general. So I apologize if my question is TOO silly.
The report consists of Sales Header and Sales Lines, based in a condition written in C/AL.
My problem is that I am trying to show a separation line in the report. But only if one of the "Shipping Agent-Code", "Sell-to Customer No." or "Ship-to Code" Fields from the Sales Header Table change from the previous record. I'd like to store the value of the previous record and compare its values with the current record.
I have wrote a line as text in the SalesHeader Body section in the report, that should be only show if the NewSection boolean is set to true:
CurrReport.SHOWOUTPUT(NewSection);
And I have wrote this code to control the value of "NewSection":
Sales Header - OnPreDataItem()
PreviousShipToCode := "Sales Header"."Ship-to Code";
PreviousShippingAgentCode := "Sales Header"."Shipping Agent Code";
PreviousCustomer:= "Sales Header"."Sell-to Customer No.";
Sales Header - OnAfterGetRecord()
NewSection := False;
IF ("Sales Header"."Shipping Agent Code" <> PreviousShippingAgentCode) OR
("Sales Header"."Sell-to Customer No." <> PreviousCustomer) OR
("Sales Header"."Ship-to Code" <> PreviousShipToCode) THEN NewSection := True;
Unfortunately, it does not work...
I do not know if this is the correct way to solve this problem, or if there is a smarter way to do this.
Any help or idea will be appreciated. Many thanks in advance,
Josetxo
first of all, I'd like to make you know that I am new in Navision development... and in development in general. So I apologize if my question is TOO silly.
The report consists of Sales Header and Sales Lines, based in a condition written in C/AL.
My problem is that I am trying to show a separation line in the report. But only if one of the "Shipping Agent-Code", "Sell-to Customer No." or "Ship-to Code" Fields from the Sales Header Table change from the previous record. I'd like to store the value of the previous record and compare its values with the current record.
I have wrote a line as text in the SalesHeader Body section in the report, that should be only show if the NewSection boolean is set to true:
CurrReport.SHOWOUTPUT(NewSection);
And I have wrote this code to control the value of "NewSection":
Sales Header - OnPreDataItem()
PreviousShipToCode := "Sales Header"."Ship-to Code";
PreviousShippingAgentCode := "Sales Header"."Shipping Agent Code";
PreviousCustomer:= "Sales Header"."Sell-to Customer No.";
Sales Header - OnAfterGetRecord()
NewSection := False;
IF ("Sales Header"."Shipping Agent Code" <> PreviousShippingAgentCode) OR
("Sales Header"."Sell-to Customer No." <> PreviousCustomer) OR
("Sales Header"."Ship-to Code" <> PreviousShipToCode) THEN NewSection := True;
Unfortunately, it does not work...
I do not know if this is the correct way to solve this problem, or if there is a smarter way to do this.
Any help or idea will be appreciated. Many thanks in advance,
Josetxo
0
Answers
-
Make sure your data is sorted on "Shipping Agent-Code", "Sell-to Customer No." and "Ship-to Code", add those fields to the "GrouptotalFields" property of the dataitem, and add a groupfooter with your line.0
-
Hello,
I have tried as you suggested and works for us!
Many thanks for your fast answer and for solving the problem.
Josetxo0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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