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

Stripping parts of a text field

Status
Not open for further replies.

matpj

Technical User
Mar 28, 2001
687
GB
I have a project name field that appears in my report which is usually in the format:

UKE12345 Project Title is here - Des

I need to strip the first part of it off, and the end, so that I am left with:

"Project Titlw is here"

Occasionally there is no first part, so I need to detect it first and then remove it.
The last bit may need detecting also and these will be either '- Des' or '- Dev'
can anyone suggest how to do this?

 
Please share technical information, at the very least the version of your software.

Try:

whileprintingrecords;
stringvar ProjectTitle:= {table.field;
If left(ProjectTitle[1],6) <> "Project" then
ProjectTitle := mid(ProjectTitle,instr(ProjectTitle," ")+1);
If instr(ProjectTitle,"-") > 0 then
left(ProjectTitle,instr(ProjectTitle,"-") -1)
else
Projecttitle

Should get you close.

-k
 
thanks for that, i'll give it a go.

sorry about the lack of technical stuff.
i'm running Crystal Reports 9 on windows 2000

 
just lokoing at this, and my original post only contained "Project Title is Here"
as an example of where the project name is in the string.

your formula is actually looking for the string "Project"

in reality the project name could be anything.
how would I change this to look at the first 3 characters containing 'UKE'? (if yes then strip the first 9 characters)

thanks,

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top