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!

Code Works in SQL but not in Crystal Reports

Status
Not open for further replies.

lesleycampbell

Technical User
Jun 21, 2013
59
US
I am using CR11. I have the following code that works correctly in SQL but will not produce results in SQL.

{EmployeeMaster.ServiceArea} like "%AL%"

Can I not use the % in CR? Is there another version of the same type of code that is better suited for CR?
 
The Percentage symbol ("%") is a wildcard in SQL but not in Crystal. Use the Asterisk ("*") instead.

Pete
 
Awesome! Thank you so much!

Do you know what code I might be able to use to exclude anything that includes certain characters, but still utilizing the wildcard feature?

For instance, I don't want to include anything that contains 'UDB' so I would be looking for '*UDB*'.
 
either you can use in the record selection criteria
not({EmployeeMaster.ServiceArea} like "*UDB*")

or the suppress condition in the section expert
{EmployeeMaster.ServiceArea} like "*UDB*"
 
And what BettyJ says is of course correct, but you should also bear in mind it is much more efficient to deal with it in the Record Selection and let the Database Server do the filtering and pass back only the necessary records, rather than the suppression approach which requires that all records get pushed back to the local computer (wherever the report is being run), and unnecessary records hidden.

The other disadvantage of simple suppression is that values from suppressed rows will still be included in totals etc unless specifically excluded which adds to the inefficiency.

Sometimes it is difficult to avoid the suppression approach, but where possible it should be avoided.

Hope this helps


Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top