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

Capture certian data that is in a field 1

Status
Not open for further replies.

Donna059

Technical User
Nov 2, 2005
1
US
I am trying to create a report that will pull certian data from a field.

Field contains a lot of text and I need to only see the one word from all the text based on a filter (I have already created)

Example:
Field 1: donna
Field 2: donna needs help with crystal

I want to show all records that included "needs" (which I have done), but only display the word after "needs". My report would display the word "help".

Can anyone help???
 
One formula would be something like:

whileprintingrecords;
stringvar thefield:= {table.field};
stringvar Helpstring := "";
if instr(thefield," help ") > 0 then
Helpstring := trim(mid(thefield, instr(thefield," help ")+6))
else
Helpstring := "";
if len(Helpstring) > 0 then
left(Helpstring, instr(Helpstring," "))
else
""

You could also use break the field into an array, and then iterate through the array, but that's probably slower than the above.

-k
 
Here is another approach. Create a formula:

if ubound(split({table.string},"needs ")) > 1 then
left(split({table.string},"needs ")[2],
instr(split({table.string},"needs ")[2]," ")-1)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top