Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: optional parameters? Post Reply Post New Topic
Author Message
foxy
Groupie
Groupie
Avatar

Joined: 12 Jul 2007
Online Status: Offline
Posts: 50
Quote foxy Replybullet Topic: optional parameters?
    Posted: 15 Oct 2007 at 2:31am
I have a date range parameter.
 
I want the user to ba able to choose whether to enter a date range or not. So if the date range parameter is left blank, then the report will return everything.
 
Anyone know how to do this?
 
Thanks
FOXY
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 15 Oct 2007 at 9:06am
You can't have optional parameters. However, you can use default parameters such as 'All' in the list of values and then change your record selection filter to account for this. But for dates, this isn't possible and the user has to enter some type of date value.
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>
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 15 Oct 2007 at 12:28pm
An alternative is to add another parameter (@selection)and use this as part of the record selection formula.

Example

if {@selection}="selected" then

{table.location}={@location}

else if {@selection}="date" then
({table.location}={@location} and ({table.date} in {@date1} and {@date2}))

Using alternate selection formulas based on an independent parameter allows you to create the concept of optionality.

Sarah
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 15 Oct 2007 at 12:46pm
But doesn't the user still have to enter SOME value for the two date parameters? I see how this could let the user enter junk values for the date parameters and they get ignored, but something would have to be added nonetheless (unless you have default values and they just leave them alone)?
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>
IP IP Logged
foxy
Groupie
Groupie
Avatar

Joined: 12 Jul 2007
Online Status: Offline
Posts: 50
Quote foxy Replybullet Posted: 16 Oct 2007 at 12:40am
Is it not possible to put in some sort of formula that says somthing like
 
if isnull({@daterange}) then true
 
Or will this not work?


Edited by foxy - 16 Oct 2007 at 12:43am
FOXY
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 16 Oct 2007 at 1:36am
We had a report with loads of data parameters, only the first or second of which would usually need to be set, and unset ones needed to be printed as blank.
We dealt with it by setting the parameter default to 01/01/00, and then suppressing the field if that was the value.
IP IP Logged
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.008 seconds.