Print Page | Close Window

Truncate first four characters of variable string

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4420
Printed Date: 29 Mar 2024 at 4:23am


Topic: Truncate first four characters of variable string
Posted By: New_Bie
Subject: Truncate first four characters of variable string
Date Posted: 01 Oct 2008 at 8:49am
I'm a Crystal novice.  I need some help to truncate the first four characters from the display of a text string.  The text string length is variable and the first four characters are always the same.

Text string example 1 in dbase is "TRE-CODE22325"
Text string example 2 in dbase is "TRE-BOR5595-RFB"
Text string example 3 in dbase is "TRE-449408"

I need remove the "TRE-" from the display of each text string.

I know there is a formula to do this, but I'm not experienced enough yet to get things to work.  Any assistance would be greatly appreciated.

Thanks.

 




Replies:
Posted By: JohnT
Date Posted: 01 Oct 2008 at 12:33pm
You can use the MID function.  Setup a formula field called newtext (or whatever) that has the following formula:
 
MID(text string, 5, len(text string) - 4)
 
This will return a string from position 5 through the end.
 
Move newtext to your report.
 
Good luck.
 


Posted By: ezeney
Date Posted: 01 Oct 2008 at 1:20pm
MID(text string, 5) will do the same job.


Posted By: New_Bie
Date Posted: 02 Oct 2008 at 7:13am
Thanks.  That worked perfectly.



Print Page | Close Window