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
0
Answers
I have tried as you suggested and works for us!
Many thanks for your fast answer and for solving the problem.
Josetxo