Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting array and error with array limit

Status
Not open for further replies.

morechocolate

Technical User
Apr 5, 2001
225
0
16
US
I need to display, in group footer 1, loans from the detail section. In the detail section I can have more than one loan. Therefore, I set up an array to capture the loans. The problem I am having is that I need to reset the array for each group because without doing so I am going over the number of allowed elements in a array. Feedback is appreciated.

I am using Crystal 8.5

@formula1
BeforeReadingRecords;
global NumberVar x;
global NumberVar y;
global stringVar Array loans;
global numberVar strLen;

@formula2 - in details
WhileReadingRecords;
global NumberVar x;
global NumberVar y;
global stringVar Array arMaster;
global stringVar Array arLoans;
Local StringVar strLoanNum := {P.LOAN};
global numberVar strLen;

if Not (strLoanNum in arMaster) then
(x := x + 1;
Redim Preserve arMaster[x];
strLen := strLen + Length(strLoanNum)+1; //add one to allow for comma separation
select strLen
case 0 to 254:
if Not (strLoanNum in arLoans) then
(y := y + 1;
Redim Preserve arLoans[y];
arLoans[y] := {P.LOAN};)
default:
'';
)

@formula3 - in group footer
WhilePrintingRecords;
global stringVar Array arLoans;
Join(arLoans,chr(13))
 
I think you shouldl change both to "whileprintingrecords" and your first formula should be:

Whilerprintingrecords;
NumberVar x := 0;
NumberVar y := 0;
stringVar Array loans := "";
numberVar strLen := 0;

-LB
 
As always LB, thanks for your help.

I had to do a couple of things. For formula1 I had to do what you mentioned and change loans to arLoans plus add
global stringVar Array arMaster := "";

In formula2 I had to change the evaluation time to WhilePrintingRecords as well.

Thanks

p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top