Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Posted: 21 Mar 2008 at 10:27am
If you're looking to find if a string is part of a larger string (a substring), then use the Like operator with a wildcard. For example, your record selection formula would be:
{table.field} LIKE "*"&{?parameter}&"*"
You can learn lots of tips and tricks for working with parameters in my Crystal Reports eBooks.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
Joined: 11 Sep 2008
Location: United States
Online Status: Offline
Posts: 3
Posted: 11 Sep 2008 at 10:37am
I am trying to use the LIKE "*"&{?parameter}&"*" statement in my crystal report but it doesn't seem to work, but when I copy the code out of crystal report and run it in SQL it works.
This is the line of code in crystal: {provider.fullname} like {?ProviderName} & "*"
This is how the line of code translate in SQL: provider."fullname" LIKE 'adams%'
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 11 Sep 2008 at 11:29am
Is your database case sensitive? You can test this by entering looking at the data and then entering the parameter in the same format as the data. For example, if the value in the provider.fullname field is in the format "Adams..." then enter your parameter as "Adams" instead of "adams". If that works, then your database is case sensitive. In that case, you'll need to manually update your selection formula to something like:
upper({provider.fullname}) like upper({?ProviderName}) & "*"
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum