Hi guys.
I am creating a report based on sales invoice header and line table.
I have not idented the ItemCrossReference so I use the GET function to get into the report some fields from the ItemCrossReference.
In the first Record information is OK but on the second it puts the same information of the first record from the ItemCrossReference.
Here is the Code:
Sales Invoice Line - OnAfterGetRecord()
IF ICrossReference.GET("Sales Invoice Line"."No.","Sales Invoice Line"."Variant Code",
"Sales Invoice Line"."Unit of Measure Code",ICrossReference."Cross-Reference Type"::Customer,
"Sales Invoice Line"."Bill-to Customer No." ,"Sales Invoice Line"."Cross-Reference No.") THEN;
Then on my Section:
Sales Invoice Line (3) I put the a textbox with a field from ItemCrossCeference.
What is missing?
Thanks.
Comments
In this code if you Get then you do nothing.
But if your get fails you don't to anything. The variable is not cleared and it maintains the last values.
Try IF ICrossReference.GET(...) THEN BEGIN
END ELSE BEGIN
CLEAR(ICrossReference);
END;
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I put GET to point to the Record on the ItemCrossReference.
I used the code that you mention.
The first record it returns sucessful.
Then in the 2nd record the information associated is blank.
I can i update the records 2 and the following records??
Thanks
Can you please elaborate more on this?
Information on the tables
Item 1 - No. 123 -> ItemCrossReference.Description2 -> "Information about the item 1"
Item 2 - No. 999 -> ItemCrossReference.Description2 -> "Information about the item 2"
REPORT
Item No. Description2
123 Information about the item 1
999
On the Item2 with the Nº. 990 the information is not updated with the text "Information about the item2"
The user puts the ItemCrossReference No. on the 2nd item after the invoice has been register.
I check and this Item Cross Reference No. is empty, so it returns nothing and the value that is return is blank.