Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Command "Like" Post Reply Post New Topic
Page  of 2 Next >>
Author Message
sa-user
Groupie
Groupie


Joined: 29 Jun 2011
Online Status: Offline
Posts: 65
Quote sa-user Replybullet Topic: Command "Like"
     Posted: 14 Jul 2011 at 2:48am
Hi
 
How do i use a command similar to below
 
 
{Command.COUNTRY} like {%?Country%}
 
something like select * from country where name like '%C%'
 
Thanks
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 14 Jul 2011 at 3:12am
i found this when i search the web
CStr({LIST_ITEMS.ITEM NUMBER}) Like '*6*'
i would substitute your field for the field and your parameter for 6
sharona
IP IP Logged
sa-user
Groupie
Groupie


Joined: 29 Jun 2011
Online Status: Offline
Posts: 65
Quote sa-user Replybullet Posted: 14 Jul 2011 at 3:28am

This is what i use now

{Command.COUNTRY} like {?Country}
 
?Country is a value entered by the user, this could be upper case or lower case and could be part of the country name.
 
What is the crystal reports equivalent to achieve the above.
 
something like
 
caseinsensitive {Command.COUNTRY} like {%?Country%}
 
CStr did not work do did
{Command.COUNTRY} like  '%'+{?Country}+'%'


Edited by sa-user - 14 Jul 2011 at 3:35am
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 14 Jul 2011 at 3:35am
parameters are generally not case sensative.
 
does yours work currently?
sharona
IP IP Logged
sa-user
Groupie
Groupie


Joined: 29 Jun 2011
Online Status: Offline
Posts: 65
Quote sa-user Replybullet Posted: 14 Jul 2011 at 3:36am
caseinsensitive
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 14 Jul 2011 at 4:09am
what are you actually trying to accomplish, the less information you provide that harder it is to help you.
sharona
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 14 Jul 2011 at 4:15am
im guessing the issue you are experiencing is:
 
you are trying to eliminate user error input?
 
ie,
 
customer types ENGERLAND in the parameter field, when it should be ENGLAND
 
therfore returns blank data?
 
 
or am I completely wrong?
 
If im correct, then perhaps eliminate the possibilty of entering an error.
 
import your COUNTRY field into the parameter and set ALLOW CUSTOM VALUES to FALSE
 
Regards,

Michael Jones
IP IP Logged
sa-user
Groupie
Groupie


Joined: 29 Jun 2011
Online Status: Offline
Posts: 65
Quote sa-user Replybullet Posted: 14 Jul 2011 at 4:32am
my question is how to have something like below in crystal formula equivalent to ,
select name from country where name like '%C%'
 
I have am using something like
 
{country.name} like {?country}  
Where ?country is a parameter
How do i use wildcharacters ?
 
 


Edited by sa-user - 14 Jul 2011 at 4:33am
IP IP Logged
Robotacha
Groupie
Groupie
Avatar

Joined: 11 Nov 2009
Location: United Kingdom
Online Status: Offline
Posts: 97
Quote Robotacha Replybullet Posted: 14 Jul 2011 at 5:03am
you would use wild characters in crystal like this:

{customer.name} like "M???????"  
or
{customer.name} like "M******"
 
Im not a massive guru on crystal, but from what i can gather, you are making things difficult for yourself.
 
You will need to account for so many possible user entries.
 
There may be an easy way that someone might know, but the oly option I can see for it to work in crystal is:
 
Create a formula called PARAMETER
 
this formula will simply be: LEFT({?country},1)
 
this will give you the first letter of the user input..
 
 
then try some combination of:
 
{country.name} like {@parameter}&"??????"
 
but again, this wont account for the length or amount of chracters the user has inputted...
 
Its really messy.
 
 
Do YOU HAVE to do it this way?
 
I stil lthink the better option would be for YOU to define a list of countrys that the user can select from, but there may be good valid reasons why this is not a viable option for you.
 
 
im trying for ya though!
 
 
Regards,

Michael Jones
IP IP Logged
sa-user
Groupie
Groupie


Joined: 29 Jun 2011
Online Status: Offline
Posts: 65
Quote sa-user Replybullet Posted: 14 Jul 2011 at 5:14am
Mike thanks for the explaniation. It makes sense for me to populate  countries. But there are other values also to be searched for which the count could be very huge in the database in which case some solution like this is preferable.
 
 
IP IP Logged
Page  of 2 Next >>
Printable version Printable version

Forum Jump
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