I am having a problem handling an array error when I run a report with no data. I use CR XI connecting to a SQL Server database. The report populates an array with medical recommendations for a patient, in the report this data displays on individual lines in the details section, the array is used to display the recommendations in the group footer section for each patient on one line. When there are no recommendations for any of the patients in the report I get the error "An array dimension must be an integer between 1 and 100". The report is grouped by Patient and I have looked in the help sections of CR and read that CR is not able to handle arrays with 0 elements. I am looking for any input on handling this situation so instead of the error they either get a report with blank entries or some type of message displaying "No Records". My codes is below.
@Recommendation //Formula used to populate array
If {USEchoImpressionsAndRecommendations.Impression/Recommendation} = "Recommendation" then {USEchoImpressionsAndRecommendations.Description Detail}
@Recommendation Declare //Placed in group header
WhilePrintingRecords;
Global stringvar Array vRec;
Redim vRec[DistinctCount({@Recommendation})];
Global Numbervar vRecCount := 0;
@Recommendation Populate //Placed in details section
WhilePrintingRecords;
Global Stringvar Array vRec;
Global Numbervar vRecCount;
if not ({@Recommendation} in vRec) then
(
vRecCount := vRecCount + 1;
vRec[vRecCount] := {@Recommendation};
);
@Recommendation Display --Placed in group footer
WhilePrintingRecords;
Global StringVar Array vRec;
replace(replace(Join(vRec, " ** ")," ** **","")," **","")
Thanks in advance for any help you can give.
@Recommendation //Formula used to populate array
If {USEchoImpressionsAndRecommendations.Impression/Recommendation} = "Recommendation" then {USEchoImpressionsAndRecommendations.Description Detail}
@Recommendation Declare //Placed in group header
WhilePrintingRecords;
Global stringvar Array vRec;
Redim vRec[DistinctCount({@Recommendation})];
Global Numbervar vRecCount := 0;
@Recommendation Populate //Placed in details section
WhilePrintingRecords;
Global Stringvar Array vRec;
Global Numbervar vRecCount;
if not ({@Recommendation} in vRec) then
(
vRecCount := vRecCount + 1;
vRec[vRecCount] := {@Recommendation};
);
@Recommendation Display --Placed in group footer
WhilePrintingRecords;
Global StringVar Array vRec;
replace(replace(Join(vRec, " ** ")," ** **","")," **","")
Thanks in advance for any help you can give.