Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter has no value msg

Status
Not open for further replies.

RenaG

Programmer
May 3, 2011
132
US
I am working in Crystal 2011 (aka 14).

I have an input parameter that is Type: number and set up as Optional Prompt: True and Default Value:0
I have this in my Record Selection:
If IsNull({?MD_NP_PA}) or {?MD_NP_PA} = 0 Then
true
Else
{Schedule.Staff_ID} = {?MD_NP_PA}

When I run the report and do not select the MD_NP_PA parameter, I get this message:
Parameter has no value

How do I get around this?

TIA!
~RLG

 
For testing optional parameters you need to use HasValue.

Cheers
Pete
 
Thanks, Pete. That works perfectly! Here is the code that I used:

If HasValue({?MD_NP_PA}) Then
{Schedule.Staff_ID} = {?MD_NP_PA}
Else
true

So is setting a default value irrelevant?

TIA!
~RLG
 
I don't have access to a version of CR that has Optional Parameters to test this, but as far as I know, the default value only pre-populates the parameter when the report is run, but the fact it is optional allows for that default option to be deleted prior to submitting. If not flagged as optional, only Text parameters can be left blank (in which case CR interprets it as an empty string) - all other parameter types needed an appropriate value or the report will not run.

Hope this helps.

Cheers
Pete
 
Hi Pete,

I did some playing with this. If I set the default (and it has to be one of the options in the parameter list; not 'X' or something random) and then don't do anything with that parameter then the default value is what is passed to the report (it is not blanked out). I think the key is that the default value has to be one of the options in the list which is not what I had set it to. So if the user truly doesn't want to use that parameter, then they have to manually remove the default value from the Selected Value list. I can leave the Default Value option blank and it works fine since you showed me the HasValue function [2thumbsup]

Have a great weekend!

~RLG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top