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

Searching for text to highlight 1

Status
Not open for further replies.

jcl5

IS-IT--Management
Dec 6, 2002
89
GB
I have a text field that has different notes added by different staff. Each staff prefix their notes with their initials. I want to search for the prefix say 'CS' and highlight the whole block of text with that prefix.

Is that possible?

Thanks

jcl5
 
Is prefix a database field or just the first 2 characters of the memo field?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Assuming there is a different record for each staff person's entry, then right click on the field->format field->border->background->x+2 and enter:

if left(trim({table.string}),2) = "CS" then cryellow else crnocolor

Although I think your ability to use the field in a formula, if it is a memo field, depends on your version of CR.

-LB
 
I'm using Crystal 9 and the field is a memo field which may consist of the following example:-

CS. Called back as requested and sent information required.....

AB. Arranged appointment for sales visit.....

LM. Customer satisfacion survey ....

What I want to do is highlight each different users block of text a different colour?

Can it be done?
 
Is your example from one record or three? If from three, then my earlier suggestion should work, although you would add separate clauses for each user code, as in:

if left(trim({table.string}),2) = "CS" then cryellow else if left(trim({table.string}),2) = "AB" then crred else
if left(trim({table.string}),2) = "LM" then crgreen else crnocolor

If this doesn't work, please share the error message you are getting.

-LB
 
If this is CR 9/10 you can apply formulas to the memo field. Create a formula that looks for those initials and construct an HTML expression (using HTML tags and Crystal functions such as InStr() and MID() ) to highlight each portion.

Then, place the resulting formula on the report layout and set the Text Interpretation" option (Format editor, Common Tab) to HTML.

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
If there are multiple users per record, you might be able to use the split function, if there is a return before each new user:

//{@split1}:
split({table.string}, chr(13))[1]

//{@split2}:
if ubound(split({table.string},chr(13))) > 1 then
split({table.string},chr(13))[2]

//{@split3}:
if ubound(split({table.string},chr(13))) > 2 then
split({table.string},chr(13))[3]

You could place these in separate detail sections, one below the other, and then use a field formatting formula like:

if left(trim({@split1}),2) = "CS" then cryellow else
if left(trim({@split1}),2) = "AB" then crred else
if left(trim({@split1}),2) = "LM" then crgreen else crnocolor

...changing the formula name to match the formula field you are formatting.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top