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

stripping data out of a memo field in crystal report

Status
Not open for further replies.

jenreb1

Programmer
Dec 21, 2004
4
US
my table, I have a memo field called "child_instructions". In the field's data there is the word SUTURE - I want to strip all the data from BEFORE the word SUTURE off and display the rest.

I tried using the Ltrim function but it doesn't work on the data type memo field .... anyone have an idea on how I can get this data to display ?

TIA.
Jenn
 
What version of CR are you using?

Memo fields can be used in a formula with version CR9 and later.

Use left({table.field},instr({table.field},"SUTURE"))
or
left({table.field},instr({table.field},"SUTURE")-6)
if you don't want to include that word

Editor and Publisher of Crystal Clear
 
I am suing 8.5 - maybe that is my problem, I get a syntax violation when I use that code :( ...
 
Hi jenreb1, I use 8.5 too, it's actually not that tricky. First you go down to "SQL Expressions Field" in the Field Explorer and click on "New" to create an expression. Let's name it "UnMemoChildInstructions" for this example. Don't worry, you don't really need to know any SQL to do this. Lets say your table is called JenrebsTable and your field is called "child_instructions". Now type in this expression:

{fn LEFT(JenrebsTable."child_instructions",250)}

Yes, those quotes are needed (it's a little different than Crystal formula syntax. What we have now is a SQL expression that contains the first 250 characters of the text in the memo field child_instructions. You can use UnMemoChildInstructions in place of the field name in your report or in any formulas now that you have created it.

So now you can use chelseatech's advice from above, only modified to this:

left(%UnMemoChildInstructions,instr(%UnMemoChildInstructions,"SUTURE"))

Hope that helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top