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

Find text string in a field 3

Status
Not open for further replies.
Jun 4, 2013
6
US
Hello,

I have a field or record that I want to search for the word "capture". I also want to run the report for only the records of the day that contain "capture". Any record that has this word would show on the report, but if the record does not contain the word then the record is not shown on the report.

The field is CallLog.Calldesc

So far I have: Date (Calllog.rcvdDate) = current date and ....


Thanks for your help.

 
Try:

Code:
InStr(CallLog.Calldesc, 'capture') > 0

This assumes that 'capture' always appears just like that, ie all lowercase. If the case can vary, try it this way instead:

Code:
InStr(LowerCase(CallLog.Calldesc), 'capture') > 0


Cheers
Pete
 
Pete,

How's about if I want to add more words for the search. In this string, can I use double quotes? Why are you using single quotes?

Thanks.
 
Hello,

Please check my syntax for errors. For some reason I am getting records that are older than todays date. Am I missing something here. Thanks for the expertise..

Date({CallLog.RecvdDate}) = CurrentDate and

InStr ({CallLog.Calldesc}, 'capture') > 0
or
InStr ({CallLog.Calldesc}, 'pin pad') > 0
or
InStr ({CallLog.Calldesc}, 'scanner') > 0
or
InStr ({CallLog.Calldesc}, 'client upload service') > 0
 
Chameleon00,

Just some Parathesis needed, I am thinkin' [smile]

Code:
Date({CallLog.RecvdDate}) = CurrentDate and
[red][b]([/b][/red]
InStr ({CallLog.Calldesc}, 'capture') > 0
or
InStr ({CallLog.Calldesc}, 'pin pad') > 0
or
InStr ({CallLog.Calldesc}, 'scanner') > 0
or
InStr ({CallLog.Calldesc}, 'client upload service') > 0
[b][red])[/red][/b]

Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
You can also try this

Date({CallLog.RecvdDate}) = CurrentDate and
(
lowercase({CallLog.Calldesc}) like "*capture*"
or
lowercase({CallLog.Calldesc}) like "*pin pad*"
or
lowercase({CallLog.Calldesc}) like "*scanner*"
or
lowercase({CallLog.Calldesc}) like "*client upload service*"
)
 
Hi Betty,

Will this search for lower case words only, and what are the astericks for?

Thanks.
 
Chameleon00,

Betty's solution is an alternate solution to InStr(). In her method, the contents of your CallDesc field are coverted to all lower case ("MiKe" would become "mike"), which is why the "LIKE" portion is in all lowercase as well. The asterisk's are "wild cards" meaning that any character can preceed or follow the desired string. I personally have not worked much with "LIKE" to know much more detail.

InStr() returns the starting character position of the desired string, and therefore is greater than zero when the string exists within the other and thus why the first method looks for records where the result of InStr() is greater than zero.

In regards to the parathesis, it is just a matter of "grouping" what you are seeking... the parathesis in this case make the overall criteria "{DateField} is Current Date AND (any of the OR clauses)", without the parathesis Crystal reads it in order, or in your original posting (unwirtten parathesis added for demonstration purposes) "[red]([/red]{DateField} is current AND capture in {CallDesc}[red])[/red] OR "pin pad" in {CallDesc} OR "scanner" in {CallDesc} OR "client upload services" in {CallDesc}"

Ultimately, I read your post before my first reply too quickly, and you should add the LowerCase() function within the InStr() to ensure that any "casing" of the phrases you are looking for are present. Ex: InStr({Field},"Mike") will only return a value greater than zero where the string is exactly capital "M" and lowercase "ike", "MIKE", mike", "MiKe", etc would not be found unless you covert the "case" of your {CallDesc} field to either all UPPERcase (function: UpperCase({your field})) or all lowercase (function: LowerCase({your field})). If you decide UPPER, the string you are looking for will also need to be in all CAPS.

Hope this helps, and I haven't muddied the waters too much on you. Cheers!



Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Hi Mike,

Thanks for the thourgh explanation and the professionalism. It definately helps.

Have a good one. :)
 
And to answer the question about single/double quotation marks, the answer is it doesn't matter - either will work.

I use single quotes out of habit because in some other applications (Database Query tools) double quotes don't work.

Hope this helps.
Pete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top