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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Arrays

Status
Not open for further replies.

paulcooke

Programmer
Dec 11, 2003
35
GB
Hello
Just a quick query basically I want to know how to create a global array to store data which I can then use in the evalute part of a running total formula to search and see if I need to add amount to the total. However struggling to create an array.

So far I put to in my consolidated invoice array formula which utilimately store all consolidated invoices references just some test data. See below

WhilePrintingRecords;
Global StringVar Array ConsolidatedInvoices;
ReDim ConsolidatedInvoices[5];
ConsolidatedInvoices[1] = "TEST1";
ConsolidatedInvoices[2] = "TEST2";
ConsolidatedInvoices[3] = "TEST3";
ConsolidatedInvoices[4] = "TEST4";
ConsolidatedInvoices[5] = "TEST5";

However when I come to display the first element of the array with another formula I get an subscript error.
Below is the display formula

//@Display
whileprintingrecords;
Global StringVar Array ConsolidatedInvoices[1];

Any help will be gratefully received because util can successfully create an array can't begin the next phase of my problem.

Cheers
 
You forgot the ":" when setting up your array. Your formula ends up being a series of booleans.

Your formula should look like this.

WhilePrintingRecords;
Global StringVar Array ConsolidatedInvoices;
ReDim ConsolidatedInvoices[5];
ConsolidatedInvoices[1] := "TEST1";
ConsolidatedInvoices[2] := "TEST2";
ConsolidatedInvoices[3] := "TEST3";
ConsolidatedInvoices[4] := "TEST4";
ConsolidatedInvoices[5] := "TEST5";
"" //displays nothing when put on canvas


I'm guessing you don't have your array formula on the report canvas. If it's not on the canvas you'll get the subscript error

Mike
 
Cheers silly mistake not use to the crystal syntax thank you
 
And if your array is on the canvas, make sure it is either in a section above your display formula or change the display formula to:

evaluateafter({@array});
whileprintingrecords;
Global StringVar Array ConsolidatedInvoices[1];

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top