Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Arrays Post Reply Post New Topic
Author Message
susanr
Newbie
Newbie
Avatar

Joined: 15 Jun 2011
Online Status: Offline
Posts: 10
Quote susanr Replybullet Topic: Arrays
    Posted: 15 Jun 2011 at 6:59am
hi
 
I hope someone can help me! I'm getting the error:
 
A subscript must be between 1 and the size of the array
 
I've used the split function on my data as follows:
 
Split({@Address}, ",")[1]
Split({@Address}, ",")[2]
Split({@Address}, ",")[3] etc....
 
I understand why I'm getting the error message as some addresses only have 2 elements, but some have more, how can I get around this error so the formula will work on all my data no matter how many elements?
 
ConfusedConfusedConfused
Susan
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 15 Jun 2011 at 8:55am
I would gather the number of elements in the array

ubound(addressArray) and put that into a

for x:=1 to uboundVar

and pull each element out this way
IP IP Logged
susanr
Newbie
Newbie
Avatar

Joined: 15 Jun 2011
Online Status: Offline
Posts: 10
Quote susanr Replybullet Posted: 16 Jun 2011 at 2:17am
thanks, i'm afraid i'm not advanced enough to understand this Cry
 
I'm trying to do a few things.
 
The different formulas i have are:
 

local stringvar array br := chr(13)&chr(10);

replace({SL_ACCOUNTS.CUADDRESS},chr (13),",");

 
And I'm trying to resize the array:
 
Local StringVar array x := {SL_ACCOUNTS.CUADDRESS};

// resize the array to size 8 while preserving the old values.

Redim Preserve x [8];

x[8] := "";

x[8]

And then split the data into different fields:

Split({@Address}, ",")[1]
Split({@Address}, ",")[2]
Split({@Address}, ",")[3] etc....
Susan
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.