Question : passing multiple values from subreport to main report in CR

CR 9

i have a subreport for a particular field that can have multiple values for each item in the main report.

so, for example:
APPLE
     RED
     GREEN


how do i pass RED and GREEN back to the main report?  i considered an array, but i'm not sure how to determine the array size.

Answer : passing multiple values from subreport to main report in CR

A shared variable passes back the last value you set it to in the subreport.

If you have multiple values you need to pass back try this idea.  You will probably need to change it a bit to work with your fields.

In the main report add a formula to the report header
WhilePrintingRecords;
Shared StringVar Array mySharedArray;
Shared NumberVar ArraySize;
''

In the subreport detail section
WhilePrintingRecords;
Shared StringVar Array mySharedArray;
Shared NumberVar ArraySize;
ArraySize := ArraySize + 1;
ReDim Preserve mySharedArray[ArraySize];
mySharedArray[ArraySize] := {YourStringField};
''

In the main report after the subreport
WhilePrintingRecords;
Shared StringVar Array mySharedArray;
Shared NumberVar ArraySize;
Join(mySharedArray,', ')

mlmcc
Random Solutions  
 
programming4us programming4us