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!

Issues with Arrays

Status
Not open for further replies.

blairacuda

Technical User
Sep 3, 2009
51
US
Hello All,

I am having some trouble with Arrays in Crystal 8.

This code:
__________________________
NumberVar Array aCut[1];
StringVar print:="";
NumberVar arrayCount:=0;
Local NumberVar i;

if {@IsElbow} then
(
Redim aCut[4];
aCut[1]:={@S1};
aCut[2]:={@S2};
aCut[3]:={@H1};
aCut[4]:={@H2};
);

if {@IsStraight} then
(
Redim aCut[1];
aCut[1]:=888;
);

if {@IsTransition} then
(
Redim aCut[1];
aCut[1]:=999;
);

arrayCount:=UBound(aCut);


for i:=1 to arrayCount do
(
print:= print + ToText(aCut) + chr(13);
);

print;
_________________________________________________

results with this error: "A subscript must be between 1 and the size of the array."

The only way I can get it to work is if I take the Redim out of the if statement; even though the if statement is true.

At a loss.

Thanks in advance.
 
What happens if you change the first line to:

NumberVar Array aCut;

-LB
 
That was it. How did I not see that?

Thanks a ton!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top