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!

Help with a String Formula

Status
Not open for further replies.

3dservices

Technical User
Jul 3, 2002
1
CA
I'm exporting the data from access but I need to manipulate it in the report.
Example: I'm exporting the data SHOE S8-1-A-2" but I need to extract the text "SHOE " for the report. I've tried using the following formula but haven't had any luck:
If InStr({Piping.LONG_DESCR}, "SHOE") Then
Trim({Piping.LONG_DESCR});
Mid({Piping.LONG_DESCR},6)

I'm new to programming with Crystal Reports so any help would be appreciated.
 
Instr() is not purely a boolean returning either true or false, Instr() returns the character number where your substring begins, or zero if it is not found. So, try this:


If InStr({Piping.LONG_DESCR}, "SHOE")>0 Then Mid({Piping.LONG_DESCR},Instr({Piping.LONG_DESCR},),"SHOE",6)

This should also take care of any leading spaces that your trim() function woudl have done for you.

Let me know how this works.

Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
if left(trim({Piping.LONG_DESCR}), 4) = 'SHOE' then
trim(Mid({Piping.LONG_DESCR},6))

You can also use the instr() and mid() functions like this for future reference:

If InStr({Piping.LONG_DESCR}, "SHOE") Then
trim(Mid({Piping.LONG_DESCR},InStr({Piping.LONG_DESCR}, "SHOE")+1))

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top