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

retrieving the first entry in a comma-delimited field 2

Status
Not open for further replies.

PhilB2

Programmer
Nov 6, 2003
133
0
0
US
A field contains values such as:

,
,98,
,115,1023,

--in other words, ,[number,][,number,][etc.]

I tried using "split" with a count of 1 to retrieve the first number (if any), but got an error message that a formula field can't be an array. I also seemed to get an error related to the comma delimeter, but I was able to use "replace" to change the commas to "=", I suspect the "," was not the problem. I can't seem to find another approach.
 
does the field always start with a comma?
what do you want to have occur when the data has no number (like your 1st item listed)?


maybe something like this
//{@splitcomma}
split({table.field},",")[2]
 
Thank you. Yes, the field always starts with a comma.

Questions:

What does the [2] represent?

Why wouldn't I get the same error message about a formula field not being an array?
 
To fisheromacse:

I thought I posted another comment answering question #2, but apparently I didn't send it:

When the data has no number, I want the value returned to be blank or null, so that the resulting field in the report is blank or null.
 
The following worked:

Split({table.field},",") [2]

I wonder why the format in the Help (Crystal 9) produced the error message:

Split({table.field},",",2)

--Happy camper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top