Monday, April 2, 2012

Crystal Reports : Using the "all" Choice as a Parameter Value

It's very often that we see a (for example) "UserID" Parameter in a Crystal Report. This would typically allow the end user to select the proper UserID that should be used by the Select Expert.

So, our Selection Criteria would look something like this (assuming {?UserId} is the name of our Parameter:


And this is great, as long as you only want to select one UserID at a time. You could even go a step further and configure {?UserID} to "Allow Multiple Values", in which case the end user could choose any combination of UserID's for the report to Select.

However, what if you want an easy way to select "all" UserID's? I've found great success with providing an (all) item in the Parameter value list. You then test {?UserID} for the presence of the "(all)" string, and if you find it, circumvent the rest of the Selection Criteria.

This is easier than it sounds. Simply add an (all) item to your Parameter Value List, then use the following code in your Select Expert;

IF {?UserID} <> "(all)" THEN {SALES.USERID} = {?UserID} ELSE TRUE

So what we're saying here is test {?UserID} for "(all)", and if you DON'T find it, use the Parameter normally. OTHERWISE, say "TRUE", which is a trick you can use within the Select Expert to force it to "skip" a portion of itself. So if it find the "(all)", it should return all records.

Try it!


Anonymous said...

Thanks Fixed my Issue

Anonymous said...


Could you please let me know how do we include (ALL) in parameter value list. i tried using default value while creating Parameter. But i couldn't see the ALL string in the Value List.


Chanel girl bag said...

On the lower end of the fashion handbag scale at auction, we see bags from Fendi, Dior and Cartier, among others. These usually command prices from $200 to $400, depending on the material, condition and date of origin

林磊 said...

2016-2-20 leilei
jordan retro 8
christian louboutin uk
air jordan 4
burberry outlet
ralph lauren outlet
air max
louis vuitton
tiffany and co
ugg outlet
oakley sunglasses
jordan retro 4
coach outlet online
ray ban sunglasses
oakley sunglasses
nike store uk
coach factory outlet online
michael kors handbags
coach factory outlet online
nike huarache
toms outlet
canada goose jackets
ugg boots
louis vuitton borse
burberry outlet
air jordan 8
chaussure louboutin
canada goose jackets
nike outlet
nike trainers
longchamp le pliage
louboutin outlet
montblanc pens
toms shoes
christian louboutin
ray bans
burberry scarf
michael kors bags
nike sb dunks
cheap jordans
pandora charms

Hua Cai said...

cheap jordans
nba jerseys
nike free 5
michael kors online outlet
coach outlet
polo ralph lauren
jordan 11
michael kors outlet
pandora jewelry
louboutin pas cher
burberry sunglasses
cheap michael kors handbags
louis vuitton neverfull
cheap oakley sunglasses
fitflops sale
coach outlet online
hollister shirts
nike uk store
mulberry handbags
ray ban sunglasses
tory burch outlet
cazal outlet
thomas sabo outlet
true religion jeans sale
polo pas cher
true religion canada
coach outlet canada
polo ralph lauren
adidas shoes
michael kors handbags
ralph lauren outlet
tiffany and co
cheap snapbacks

chenlina said...

coach outlet
jordan femme
timberland boots
air jordan shoes
michael kors
under armour
nba jerseys
coach factory outlet
michael kors uk
michael kors