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

Split Command and Error 1

Status
Not open for further replies.

AntonioPerera

Vendor
Jan 29, 2006
91
AU
Hi,
I am using Crystal XI and I am trying to perform a split function.

My data field is looks like this: (e.g)
A01-Admin
D001-Dorm
Z1-Temp

I would like to split it as "A01" on a separate column in my report and "Admin" on a separate column

The formula I used was
split (field,"-")[1] to get the data for my first column
and
split (field,"-")[2] to get the data for my second column

However, crystal reports throws up the following error :
A subscript must be between 1 and the size of the array

There are some null vlaue sin the field and I suspect that may be causing the problem.

I am trying to figure out how to resolve this.
 
//{@formula1}:
if isnull(field) then
"" else
split(field,"-")[1]

//{@formula2}:
if isnull(field) then
"" else
if ubound(split(field,"-")) > 1 then
split(field,"-")[1]

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top