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!

String Extract

Status
Not open for further replies.

heyalmo

Technical User
Jun 14, 2000
15
0
0
US
Crystal 7.0.1.100
Oracle 8.0.5.0.0

How can I extract the first word in a string? Where the word is of variable length.

Is there a function which will allow me to extract the text value from the first text character until the first space in a string?

 
On Crystal you can make a formula for the text you want to extract the letter.
use the Left funtion like this
Left(name,1)
You will get the fist letter of the field name. if name='Jon' then formula value will be J
 
lovalles:
Where the word is of variable length.
 
This will give a substring from the field beginning to the first space.
{fieldname}[1 to InStr({fieldname},' ')]
 
Idle,
{ITEMMAST.DESCRIPTION}[1 to InStr({ITEMMAST.DESCRIPTION}," ")]

The above produces the following error:
"The subscript must be between 1 and the length of the string."
 
fyi-
Here is how I was able to accomplish the task noted in the first post in this string.

Two Formula Fields were created.

1) ABBREV VALUE= InStr ({ITEMMAST.DESCRIPTION},' ')
2) ABBREV= Left ({ITEMMAST.DESCRIPTION},{@ABBREV VALUE} )

thanks for the assistance....
 
You could also do it this way:

left("this is", instr(1, "This is", " "))

I can't remember if Crystal syntax supports it exactly like this, but if you change it to Basic it should work for you.

Oliver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top