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

Extracting remaining paragraph from the first chr(13) from the right

Status
Not open for further replies.

bmlkidd

IS-IT--Management
Aug 10, 2011
6
US
Newbie - be gentle ...

This works fine:

left({QuoteDet.Descrip},instr({QuoteDet.Descrip},chr(13)))

This does NOT:

local numbervar x;
local numbervar y;
x := instr({QuoteDet.Descrip},chrw(13));
y := length({QuoteDet.Descrip});
right({QuoteDet.Descrip},y - x )

IT works fine in VB, why not Crystal? All I am after is segregating a paragraph into two fields on a report, one being up to the first character return, the second being from the first character return to the end.

Thanks, folks.
 
How does it not work right? Have you tried this:

right({QuoteDet.Descrip}), length({QuoteDet.Descrip}, InStr({QuoteDet.Descrip}, chr(13)))

Or this:

mid({QuoteDet.Descrip}), InStr({QuoteDet.Descrip}, chr(13)), Length({QuoteDet.Descrip}))

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Thanks for the quick response.

Yes, my first attempt was as follows:

right({QuoteDet.Descrip}, length({QuoteDet.Descrip})- InStr({QuoteDet.Descrip}, chr(13)))

However, it left the field blank. I should note there are multiple character returns in the paragraph, but again, worked fine in VB ...
 
Never mind - stupidity on my part is reigning this morning.

Embarrassed to say that I merely didn't have the field sized to encompass all of the text. Isn't there an AutoSize of some sort for fields in a report?
 
You should be able to use:

mid({QuoteDet.Descrip}), InStr({QuoteDet.Descrip}, chr(13)))

...but I agree your formula should work, so I would test the values of x and y to see what is going on. Are you getting no results at all?

-LB
 
Sorry guys - said I was a newbie. Found the "Can Grow" check box.

Thanks for the help!
 
If you add +1, you won't need 'can grow':

mid({QuoteDet.Descrip}), InStr({QuoteDet.Descrip}, chr(13))+1)

...unless there are other returns in the field in addition to the first one.

-LB
 
Thanks, but yes, there can be several returns in this field. The "Can Grow" will suffice. But good tip for the future!

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top