Options

Can't retrieve all the values in a matrix report.

Rajat_MRajat_M Member Posts: 34
edited 2016-04-27 in NAV Three Tier
Hello,

I have been asked to create a matrix report with 'Description' & 'Quantity' fields. Those fields are existed & fetch data from two different tables named 'Item Journal Line' & 'Item Ledger Entry'.

For that I have declared two record variables(RecIJL, RecILE) & 'Description' & 'Quantity' variable . I have declared only one DataItem i.e. Production Entry Header. Then I took all required fields along with 'Description' & 'Quantity' variable.

Now I want when a user selects a 'Document No.' the report will shows all Description values as column header caption along with quantity as their body. But my code doesn't retrieve all the values except only the last one. I have written the following code:

Production Entry Header - OnAfterGetRecord()

RecIJL.RESET;

RecIJL.SETRANGE(RecIJL."Document No.","Production Entry Header"."Document No.");

RecIJL.SETFILTER(RecIJL."Item Type", '%1' ,RecIJL."Item Type"::Scrap);

CLEAR(Description);

Quantity:=0;

IF RecIJL.FINDFIRST THEN BEGIN REPEAT

Description:=RecIJL.Description;

Quantity:=RecIJL.Quantity;

UNTIL RecIJL.NEXT=0;

END Else

RecILE.RESET;

RecILE.SETRANGE(RecILE."Document No.","Production Entry Header"."Document No.");

RecILE.SETRANGE(RecILE."Item Type", RecILe."Item Type"::Scrap);

IF RecILE.FINDFIRST THEN BEGIN REPEAT

Description:=RecILE.Description;

Quantity:=RecILE.Quantity;

UNTIL RecIJL.NEXT=0;

END;

Can anyone help me?? Thanking You,

Answers

  • Options
    Jan_VeenendaalJan_Veenendaal Member Posts: 206
    Hi Rajat_M,

    It seems you are putting multiple values (all the descriptions you find) into just one variable. This variable can only hold one value -> so it will only retain the last value that is found.

    So you need to think of a way to either (a) store more values [think Arrays] , or, (b - better choice I think), redesign your report to have at least 3 dataitems: 1 for the production header, 1 for the Item journal lines and 1 for the item ledger entries.
    Jan Veenendaal
Sign In or Register to comment.