Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: setting for "no parameter selected but default is Post Reply Post New Topic
Author Message
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Topic: setting for "no parameter selected but default is
     Posted: 30 Sep 2009 at 7:55pm
Hi all,
 
My customer requires that " if no institutes is selected then the default is for the report to run for all institutes"
It can be impletmented in CR 2008, but I found it difficult to implement in CR XI.
Bascially there are about a dozen institutes in the parameter list, if there is no single institue to be selected, the report has to run for all institutes.
If I put something in the formula -> record selection:
if {?institute} = "" then
   true
else
  {INS.CODE} = {?institute}
It won't work... there is error ' invalid value"
Could anyone advise on this? Thanks in advance.
 
John
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 30 Sep 2009 at 8:19pm
Which part of the condition showing error?

Jyothi
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 30 Sep 2009 at 8:30pm

After parameter pops up for selection. If I don't select any parameter (institute), and click OK, there is an error 'invalid value'

John

IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 30 Sep 2009 at 8:37pm
Try adding "ALL" string in default values of the institute parameter and select that for all institutes.

if {?institute} = "ALL" then
   true
else
{INS.CODE} = {?institute}

HTH,
Jyothi
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 30 Sep 2009 at 9:05pm
Yes, I have tried this before.  The problem is that the user has to remove 'All' from selected value if running from other selected values  before running the report, otherwise it won't work with:
All
selected value 1
selected value 2
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Oct 2009 at 7:07am
Did you try:
({?institute} = "" or {?institute}={INS.CODE})
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 01 Oct 2009 at 4:33pm
Yes,  I have tried:
if {?institute} = "" or {?institute} = {INS.CODE} then
 true
else
 {INS.CODE} = {?institute}
 
Report complains: "the value is not valid" at the parameter prompt
John
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Oct 2009 at 7:28am
Hi John,
Just some clarification here. I was recommending that you use an OR statment instead of the if-then statement as I hoped might address your other issue, although I have tested it further and it is interesting but not sure if it helps. Here is what I found ...My testing was using a param that allowed a user to type in the param option and add multiple selections to the param and a select statement using OR as I posted earlier.
It appears that you can add a "" to the Selected Values to avoid the 'Value is not Valid' warning when applying the params at run time. It the "" is the only selected item it will not apply any filter to the records. If a second value is added it will only apply that selection and ignore the "" in the select statement so it doesnot have to be removed from the selected values.
If you go with an "All" value (and change the select statement to use the "ALL nstead of "") and you leave ALL plus another selected value the ALL will take precedence and make the other selection moot.
 
Ultimately though a user must take some action at runtime to add a param value and I think adding the "" is more confusing then dealing with an ALL option as J had suggested.
 
Hope that helps.
 
 


Edited by DBlank - 04 Oct 2009 at 6:44am
IP IP Logged
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 03 Oct 2009 at 8:31pm
Hi DBlank,
 
thank you for your further advices.
 
John
IP IP Logged
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