Fixing the “This report requires a default or user-defined” error in SSRS

I was running a Reporting Services report through a WinForms application and I started getting an error when the ReportExecutionService.LoadReport method was called. The error was:

This report requires a default or user-defined value for the report parameter ‘ParkName’.

I looked at my ParkName parameter definition, and here is what I had:

<ReportParameter Name=”ParkName”>
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>Select All</Value>
</Values>
</DefaultValue>
<Prompt>Park Name</Prompt>
<ValidValues>
<DataSetReference>
<DataSetName>ParkNameDataSet</DataSetName>
<ValueField>FullParkName</ValueField>
<LabelField>Name</LabelField>
</DataSetReference>
</ValidValues>
</ReportParameter>

All looked well, but obviously something was not. I looked through similar reports that were not having parameter issues and found that when I pulled the default value from a DataSet, then all was hunky dory. So I modified the parameter definition to pull from a DataSet:

<ReportParameter Name=”ParkName”>
<DataType>String</DataType>
     <DefaultValue>
       <DataSetReference>
       <DataSetName>ParkNameDataSet</DataSetName>
     <ValueField>FullParkName</ValueField>
   </DataSetReference>
</DefaultValue>
<Prompt>Park Name</Prompt>
<ValidValues>
<DataSetReference>
<DataSetName>ParkNameDataSet</DataSetName>
<ValueField>FullParkName</ValueField>
<LabelField>Name</LabelField>
</DataSetReference>
</ValidValues>
</ReportParameter>

This did the trick. I also modified the query populated the ParkNameDataSet to return “Select All” as the default value.

Advertisements
  1. #1 by Hugo on December 23, 2013 - 11:45 pm

    In my case the problem was the available values had extra spaces at end of value so ‘ABC001’ did not equal the value from the query ‘ABC001 ‘ so it was an invalid value and it acted as if i never sent the parameter at all. I went into the query that build the available values and trimmed.. so moral of the story… always trim! lol.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: