Crystalkeen logo; we offer Crystal reports viewers and schedulers
 
Crystalkeen header image 3
Crystalkeen header image 5

Crystal Reports Tools: Improve Performance While Saving Time and Money

  Resources  
Best sellers:
cView
cViewSERVER
cViewBATCH

Articles:
Administration
Advanced
Basic
Database
Financial

Tools:

Analyzers
CR Schedulers
CR UFLs
CR Viewers
DataBase Tools
Graphics
International
Mail UFLs



 
 

Add'l:
About us

Contact Us
cViewSUITE Ppt

 

CrystalReports
on Steroids

Crystal Reports: Extract Sentences from Memo Fields

One of the welcome improvements to formulas in Crystal Reports 9.0 and 10.0 was the ability to process memo fields. You can search and extract text from a memo field.

Use the INSTR function to find the first full stop in the memo field and then use the LEFT function to extract the first sentence in that field.

If INSTR({table.memo},”. ”)>0
then LEFT({table.memo}, INSTR({table.memo},”. ”))
else {table.memo}

This brings up a related question. How do you find a sentence?

Some people use two spaces between sentences, but the standard is one space between sentences. The two-space rule dates back to the era when hand-written communication was normal. It added a bit more clarity, which was needed because of the inconsistency of handwriting. In typewritten communication, the extra space is not needed.

The two-space practice is not used in books or magazines, at all. And because many people find it irritating, it is rapidly giving way to a single space between sentences in all forms of written communication. So, don't use two spaces in the search string to look for a sentence.

You can't use a period to define the end of a sentence, because someone may use a period for another purpose. Examples of this would be an abbreviation (e.g., St. Patrick, etc.). You need to exclude those from the search. Use a variable to work your way to the end of the sentence:

Local numbervar endpos := INSTR({table.memo} + “. ”,”. ”);
If mid({table.memo},endpos-2,3)=”St.” then
    Endpos := instr(endpos+1,{table.memo},”. “); //remove St. Xxxx
If mid({table.memo},endpos-3,4)=”Etc.” then
    Endpos := instr(endpos+1,{table.memo},”. “); //remove Etc.
//Include other frequently used abbreviations
Left({table.memo},endpos)

 

OK, so you probably aren't going to be searching for sentences very much. But you will have a need to find all sorts of other things. Can you devote time to sitting around developing specific formulas for them? Nope. You'd get fired. So what's the solution?

It's Report Analyzer.

In addition to letting you search and find just about any kind of object, Report Analyzer automatically detects and documents potential performance issues--including record selection formulas, grouping options, and database options. Now you can improve report reliability and maintenance, speed development, improve resource utilization, decrease infrastructure load, and manage projects better.

 

This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects.