Report ok in the first record wrong on the following records

nav_studentnav_student Member Posts: 175
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

  • kapamaroukapamarou Member Posts: 1,152
    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;
    

    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;
  • BeliasBelias Member Posts: 2,998
    or maybe a
    ...END ELSE BEGIN
    currreport.skip
    
    ...it depends on what you want to do
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • nav_studentnav_student Member Posts: 175
    kapamarou wrote:
    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;
    

    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;


    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
  • kapamaroukapamarou Member Posts: 1,152
    Then in the 2nd record the information associated is blank.
    I can i update the records 2 and the following records??

    Can you please elaborate more on this?
  • nav_studentnav_student Member Posts: 175
    Example:

    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"
  • nav_studentnav_student Member Posts: 175
    I found it.

    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.
Sign In or Register to comment.