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!

Arrays in Crystal syntax, getting out of range error

Status
Not open for further replies.

redeemasp

Programmer
Jun 1, 2004
63
GB


I define my array at the top of the page of the main report:

whileprintingrecords;
shared stringvar array shdclientname[2];
Shared NumberVar intCount :=1;

I then have my formula in the body of the report

Whileprintingrecords;
Shared stringvar array shdclientname;
Shared numbervar intcount;
// assign client name value to
shdclientname[1] := ({command.pro_clientname});
// intcount := intcount + 1;


in my sub report I display the array

// displaying client name
whileprintingrecords;

// load in shared variables
shared stringvar array shdclientname;
shared numbervar intcount;
local numbervar intclientCount;
local stringvar DisplayClientname;

(
DisplayClientname := DisplayClientname + shdclientname[1]);
DisplayClientname

this is where I get an error.
Any idea

thanks in adv.

 
Why do you need an array? It seems like you are passing a single value.

In any case, if you do need to use an array, be sure to read about "redim" and "redim preserve"...

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Hi

redim is for crystal syntax? I thought it was just for Basic syntax?
 
There isn't a "BODY of the report", do you mean the details section? I'm glad that you didn't place it in the noggin ;)

The subreport must run AFTER the section that you call the body.

This is odd anyway as you are declaring the array as having 2 values, and then you only set one of them, again depending upon where you're doing the formula.

-k
 
SynapseVamp

Yup mean the detail section.

Yes is doesn't matter if its an array of 1 or 2, the error still occurs.

I'm defining and storing data into the array on sub report 1, located about sub report 5.

still that error occurs. Was I sold a buggy version of Crystal reports? 2 day working on a simple array is a joke!lol.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top