Parameter is missing a value ssrs 2008

吃可爱长大的小学妹 提交于 2020-01-21 02:39:11

问题


I have a parameter of integer datatype which is hidden. When i run the report, report gives me an error

Parameter X is missing a value

However if i make the parameter visible it works. I tried providing default value of 0 but that does not suffice my requirement as i have sub-report(Drill-dowm) depended on this parameter. Please help. Thanks!


回答1:


Make sure that you have not specified Available Values for the parameter. Available Values should be "None" for internal and hidden parameters.




回答2:


First of all,

Check that parameter's - Available Values by going to report parameters properties.

It must not be specified any values. So we should set it as None

Second work around is,

Just add a blank space at Specify values - in Default values inside report parameters properties.

This will surely work. Hope it will save your time.




回答3:


I had to do an "if exists" statement for this to go away. It worked for me because it makes it always return a value even if that value is not need by my query.

    if exists (my select query)
    my select query
    else 
    select '2' 
    // '2' would never be used, but it made ssrs stop giving me
    // the stupid error and execute the rest of the query



回答4:


If you specify available values from query, then default values must be in list of available values. Default value in (Available) = true.




回答5:


The problem occurs also, if you have a parameter that depends of another one without "default value" inside the Dataset Query and does not admit null value.

For example:

Parameter 1 have a default value: NameEmployee from the dataset "EmployeeSearch"

But the dataset "EmployeeSearch" have a filter or a parameter inside the query named @Month that indicate the number of the month. So if the value of @Month is null, SSRS will say "Parameter is missing a value".




回答6:


Assuming you had the same issue as I had, trying to run the report on a web page using a ReportViewer component, I managed to fix that issue by adding a null parameter before rendering the report:

C# code:

var parameters = new List<ReportParameter>();
parameters.Add(new ReportParameter("ParameterName", (string)null));
ReportViewer1.ServerReport.SetParameters(parameters);

Hope that will help




回答7:


Just need to add 1 default value to get around this error (even though that default value will never be used).

-Under "Report Parameter Properties" for that specific parameter, go to the Default Values page.

-Toggle "Specify values"

-Add a value (I added: "just_a_filler_to_get_around_hidden_value_error" so when I look back at it later I remember why I did such a thing)

-click OK




回答8:


I want to add to dmbreth's CORRECT answer.

I was missing the concept that the value of the parameter still needed to be tied to something. Originally, I was tying the output of a dataset by using the Available values portion of the parameter properties, but according to dmbreth's answer, that could not be the case. Finally I moved my output dependence settings from the Available Values section to the Default Values section and that did the trick.

So, in summary, in the parameter properties dialogue:

General Page - Allow multiple values checked(this option is specific to my application), parameter visibility set to internal

Available Values Page - None

Default Values Page - Get values from query, [appropriate dataset, value here]

Advanced Page - No significance here

Hopefully, that is clear enough to benefit someone else with the same problem...




回答9:


I had a similar issue where the default value as set by SSRS is (Null), I didn't need the parameter for my report however; I found it useful for testing to filter down the list so I kept it, I guess I could have deleted it in SSRS on the dataset config. but I changed it to =System.DBNull.Value (I guess this could be any expression) instead and that worked for me, so then I can still pass in a value if need be and also set Available values (had to make sure a NULL value was added to my dataset) if I then decide to unhide at a later date.



来源:https://stackoverflow.com/questions/11168738/parameter-is-missing-a-value-ssrs-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!