cancel
Showing results for 
Search instead for 
Did you mean: 

Array not printing correctly from main to subreport

Former Member
0 Kudos

Hi All,

I am using an array to print values from a main report to a subreport.

Here's the array formula I use in the group footer of my main report:

whileprintingrecords;

stringvar strCalls;

strCalls:=totext(Sum ({Group.Calls}, {Group.GroupNumber}))"^"strCalls

this produces a string of:

number4number3number2^number1

Here's the formula I use in the group header of my subreport:

WhileReadingRecords;

stringVar array arr;

numberVar i;

arr:=split({?Pm-@Calls Array},"^");

i:=i+1;

if i<= Count(arr) and arr<i><>"" then

arr<i>

else

""

this produces number4 on the first printed header and then blank for the rest of the headers.

My question is why are number3,number2 and number1 not printing?

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try this in subreport header.

WhileReadingRecords;
stringVar array arr; 
numberVar i;
arr:=split({?Pm-@Calls Array},"^");
i:=i+1;
if i<= Count(arr) then
arr<i>
else 
""

Regards,

Raghavendra

Former Member
0 Kudos

I tried your suggestion but no change.

Former Member
0 Kudos

Try this

WhilePrintingRecords;
stringVar array arr; 
numberVar i;
arr:=split({?Pm-@Calls Array},"^");
i:=i+1;
if i<= Count(arr) then
arr<i>
else 
""

Regards,

Raghavendra

Former Member
0 Kudos

That worked! However, my last number in the array is added twice in the array from the main report.

Former Member
0 Kudos

I think you need to split your formula into two

@formula1:

WhilePrintingRecords;
stringVar array arr; 
arr:=split({?Pm-@Calls Array},"^");

place this @formula1 in report header of subreport and suppress it.

@formula2:

WhilePrintingRecords;
stringVar array arr; 
numberVar i;
i:=i+1;
if i<= Count(arr) then
arr<i>
else 
""

Place this @formula2 in group footer where you want to show the value in subreport.

Regards,

Raghavendra

Former Member
0 Kudos

The rest of my headers are blank again.

Former Member
0 Kudos

Actually I was using the same ctr for all the formulas. Now it's working again. Thanks again!

Answers (0)