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

**URL:** <https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541>\
**Category:** Developers Forum\
**Created:** [April 27, 2016, 11:14am UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541 "2016-04-27T11:14:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajat\_M](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Rajat\_M](https://www.dynamicsuser.net/u/Rajat_M)\
**Post date:** [April 27, 2016, 11:14am UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541/1 "2016-04-27T11:14:05Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Raja123](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@Raja123](https://www.dynamicsuser.net/u/Raja123)\
**Post date:** [April 27, 2016, 11:59am UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541/2 "2016-04-27T11:59:07Z")

</div>

HI Rajat ,

You are using FindFirst which Returns Only One Record will retur Instead of that use

FINDSET…

For REference See This Links…

[FindFirst](https://msdn.microsoft.com/en-us/library/dd338835.aspx)

[FindLast](https://msdn.microsoft.com/en-us/library/dd338877.aspx)

[FINDSET](https://msdn.microsoft.com/en-us/library/dd301434.aspx)

---

<div class="post-metadata">

**Author:** ![Rajat\_M](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@Rajat\_M](https://www.dynamicsuser.net/u/Rajat_M)\
**Post date:** [April 27, 2016, 12:53pm UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541/3 "2016-04-27T12:53:26Z")

</div>

SIr,  
I did it before. But I didn’t get the required result. I think I need to modify the REPEAT…UNTIL loop…But don’t know how to! Do you have any suggessation??

---

<div class="post-metadata">

**Author:** ![xhevat.tafaj](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xhevat.tafaj](https://www.dynamicsuser.net/u/xhevat.tafaj)\
**Post date:** [April 27, 2016, 1:19pm UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541/4 "2016-04-27T13:19:04Z")

</div>

Hi,

Try To Use ‘FIND’ function

IF RecIJL.FIND(’-’) THEN BEGIN  
REPEAT  
//Some Code  
UNTIL RecIJL.NEXT = 0;

Link Below descrime in detail 'FIND’function  
[msdn.microsoft.com/…/dd301096.aspx](https://msdn.microsoft.com/en-us/library/dd301096.aspx)

If FINDSET function is used to modify record, must use: FINDSET(TRUE).

Link Below descrime in detail FINDSET function

[https://msdn.microsoft.com/en-us/library/dd301434.aspx](https://msdn.microsoft.com/en-us/library/dd301434.aspx)

---

<div class="post-metadata">

**Author:** ![Raja123](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@Raja123](https://www.dynamicsuser.net/u/Raja123)\
**Post date:** [April 27, 2016, 2:16pm UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541/5 "2016-04-27T14:16:49Z")

</div>

HI Rajat,  
i think you were Absolutely Right .i.e If each productionNo Has More Than one Items/Description And you are saving in Only One Description So All values Are Getting OverWritten on One Another.  
So Only Last Value will Solely available and only that is Printing…

SO My suggestion Would Be Add Another Dataitem(Item Ledger Entry) Under Production Entry Header (i.e Indent ILE to 1)  
And then Instead Of Declaring you could Use DataitemLink So you dont Have TO Use Setrange

Implement the Report and  
Try It Let Me Know If i left Any Issues…

---

<div class="post-metadata">

**Author:** ![mahesh\_mahi](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@mahesh\_mahi](https://www.dynamicsuser.net/u/mahesh_mahi)\
**Post date:** [April 27, 2016, 3:02pm UTC](https://www.dynamicsuser.net/t/cant-retrieve-all-the-values-in-a-matrix-report/60541/6 "2016-04-27T15:02:44Z")

</div>

Hi Rajat,

i have few questions for you

1.can you clear me one thing whether Production entry Header table having Records(data) are not?  
2.Do you want to insert the description and quantity values to Production Entry Header table or else you just want to show the values in report itself?

Thank you  
Mahesh U.
