Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Using a Wildcard in a parameter Post Reply Post New Topic
Page  of 3 Next >>
Author Message
Graham
Newbie
Newbie
Avatar

Joined: 19 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Graham Replybullet Topic: Using a Wildcard in a parameter
    Posted: 19 Apr 2007 at 7:53am
I have a report with parameters where I want to select specific customers. I want to use a wildcard entry '*' in the parameter field, when I want to return all customers within that field.
 
Can anyone please tell me how to do this?Confused
 
Graham
IP IP Logged
EscApe
Newbie
Newbie


Joined: 13 Nov 2006
Location: Finland
Online Status: Offline
Posts: 37
Quote EscApe Replybullet Posted: 07 May 2007 at 1:57am
I suggest the following solution.

- set your default value 'ALL' for parameter

- add if statement to Select Expert:
If {?Parameter}='ALL'
Then {Database.Field} like '*'
Else {Database.Field} = {?Parameter}

Then when asked for parameter, just write (or select from drop down list) ALL to get all records.
IP IP Logged
omega_red
Newbie
Newbie
Avatar

Joined: 10 May 2007
Location: United States
Online Status: Offline
Posts: 3
Quote omega_red Replybullet Posted: 10 May 2007 at 11:19am
Helpfull. worked very well
IP IP Logged
Graham
Newbie
Newbie
Avatar

Joined: 19 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Graham Replybullet Posted: 11 May 2007 at 4:48am
Works perfectly, Thanks very much for your help
IP IP Logged
aekelund
Newbie
Newbie


Joined: 05 Apr 2007
Online Status: Offline
Posts: 20
Quote aekelund Replybullet Posted: 11 May 2007 at 7:23am

This may be a dumb question but how do you set the defualt value to "all"?

IP IP Logged
omega_red
Newbie
Newbie
Avatar

Joined: 10 May 2007
Location: United States
Online Status: Offline
Posts: 3
Quote omega_red Replybullet Posted: 11 May 2007 at 7:33am
What I did...
When creating a parameter field [?] I used the value type String.
Click the button that says "Set default values"
There is a text box that says "Select or enter value to add"
Type in ALL and click the > arrow.
Add any other values.
you ar edone.
IP IP Logged
aekelund
Newbie
Newbie


Joined: 05 Apr 2007
Online Status: Offline
Posts: 20
Quote aekelund Replybullet Posted: 11 May 2007 at 7:41am
Unfortunately I don' t have a Set Defualt values button!  I am running Crystal version 11.
IP IP Logged
omega_red
Newbie
Newbie
Avatar

Joined: 10 May 2007
Location: United States
Online Status: Offline
Posts: 3
Quote omega_red Replybullet Posted: 11 May 2007 at 8:35am
I am several version behind you. I am running V9. I am assume that if you look somewhere in the parameter field setup ox for some value related thing you might find what your looking for. I am no longer of use.
IP IP Logged
vijayk
Groupie
Groupie


Joined: 14 Mar 2007
Location: United States
Online Status: Offline
Posts: 53
Quote vijayk Replybullet Posted: 11 May 2007 at 12:22pm
I suggest the following solution.

- set your default value 'ALL' for parameter

- add if statement to Select Expert:
If {?Parameter}='ALL'
Then {Database.Field} like '*'
Else {Database.Field} = {?Parameter}

Then when asked for parameter, just write (or select from drop down list) ALL to get all records.
************
 
If you use the above method, doesn't it affect the performance as it is using LIKE operator..? I am assuming in your SQL, it will append the like statement. is there anyway that it eliminates the LIKE statement from the where clause when you enter ALL or Select ALL in the parameter window.
 
Thanks
Vijay
IP IP Logged
bradschi
Newbie
Newbie


Joined: 02 Apr 2009
Online Status: Offline
Posts: 2
Quote bradschi Replybullet Posted: 02 Apr 2009 at 12:15pm
This really helped me but i do have another question.  I am trying to do this with two variables.  This is what i have in the formula editor in the select expert:

If {?Tech} = 'ALL' Then {Command.TECH} like '*' Else {Command.TECH} = {?Tech}
AND
If {?Agent}='ALL' Then {Command.AGENT} like '*' Else {Command.AGENT} = {?Agent}

If I select ALL for one and then specify the other it works fine but if i do it the other way around it shows all of both.  Any help would be greatly appreciated.


Edited by bradschi - 02 Apr 2009 at 12:16pm
IP IP Logged
Page  of 3 Next >>
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.