I have a report that has about 10 parameters and about 10 datasets and one datasource. I typed alot but I really need help so I figured I would try and provide as much info about the problem as I could right from the start.
Let's simplify it all and pretend these are the relevant names of everything and that the report gets basic employee information:
The problem:
SSRS says viewOption doesn't exist. But I see it, right there, in the Parameters folder on the left hand side. I see it when I go to enter an expression under Parameters. There is no squiggly red line under Parameters!viewOption.value. But, when I try and put it as a value for a parameter used by the getListOfNames dataset, it errors. If I put it in the getReportInfoOnSelectedPerson dataset and use it in the exact same way, SSRS is okay with that. Wtf? So... I have checked the rdl and everything is fine (where the actual parameter is declared, where it is used in the dataset reference, everything). It's just this one dataset. And I have a similar report that uses the same data set, same basic parameters and that report is fine. I try setting the value of the dataset parameter to 1 or something and that is fine but when I try and set it to Parameter!viewOption.value it errors..... Now, above I said i normally pass the stored proc a Join on the paramater with a tilde ~ but I am trying to keep it simple and either get it to just work in general (either by passing it the first value of the multivalue viewOption parameter or turning that parameter into a single select and just passing the .value) but the join doesnt work either. All of those things work for the other dataset, which is also a stored proc.
This is my error:
An error has occurred during report processing. (rsProcessingAborted) The Value expression for the query parameter ‘@viewOption’ contains an error: The expression referenced a non-existing parameter in the report parameters collection. (rsRuntimeErrorInExpression)
Which is clearly saying my parameter doesn't exist but I can SEE it... everywhere. And if I assign one of the other datasets' parameter values to the viewOption parameter it works without an error. I've checked the rdl.
I've had this problem before and it was fixed by deleting both the parameter and dataset and creating them again (for safety I renamed both of them). That didn't work this time.
I am so frustrated. Please help....
Code?
<DataSet Name="getListOfNames"> <Fields> <Field Name="personID"> <DataField>PersonId</DataField> <rd:TypeName>System.Guid</rd:TypeName> </Field> <Field Name="name"> <DataField>name</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> </Fields> <Query> <DataSourceName>myDataSource</DataSourceName> <CommandType>StoredProcedure</CommandType> <CommandText>getListOfNames</CommandText> <QueryParameters> <QueryParameter Name="@fac"> <Value>=join(Parameters!fac.Value,"~")</Value> </QueryParameter> <QueryParameter Name="@bldg"> <Value>=join(Parameters!bldg.Value,"~")</Value> </QueryParameter> <QueryParameter Name="@unit"> <Value>=join(Parameters!unit.Value,"~")</Value> </QueryParameter> <QueryParameter Name="@station"> <Value>=join(Parameters!station.Value,"~")</Value> </QueryParameter> <QueryParameter Name="@startDate"> <Value>=Parameters!startDate.Value</Value> </QueryParameter> <QueryParameter Name="@endDate"> <Value>=Parameters!endDate.Value</Value> </QueryParameter> <QueryParameter Name="@viewOption"> <Value>=Join(Parameters!viewOption.Value, "~")</Value> </QueryParameter> </QueryParameters> <rd:UseGenericDesigner>true</rd:UseGenericDesigner> </Query> </DataSet> <ReportParameter Name="viewOption"> <DataType>String</DataType> <DefaultValue> <Values> <Value>1</Value> </Values> </DefaultValue> <Prompt>View</Prompt> <ValidValues> <DataSetReference> <DataSetName>viewOptionQuery</DataSetName> <ValueField>value</ValueField> <LabelField>label</LabelField> </DataSetReference> </ValidValues> <MultiValue>true</MultiValue> </ReportParameter> <DataSet Name="viewOptionQuery"> <Fields> <Field Name="label"> <DataField>label</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> <Field Name="value"> <DataField>value</DataField> <rd:TypeName>System.Int32</rd:TypeName> </Field> </Fields> <Query> <DataSourceName>flamingo</DataSourceName> <CommandText>select 'Other Facility' as label, 3 as value union select 'Past' as label, 2 as value union select 'Current' as label, 1 as value order by value</CommandText> <rd:UseGenericDesigner>true</rd:UseGenericDesigner> </Query> </DataSet>
This is how it is set up and getListOfNames is why the error is throw, if I change
<QueryParameter Name="@viewOption"> <Value>=Join(Parameters!viewOption.Value, "~")</Value> </QueryParameter>
to
<QueryParameter Name="@viewOption"> <Value>="1~2"</Value> </QueryParameter>
then it works.... or the value can be just 1 or 1~2~3
However... when I try and put join(Parameters!viewOption.value,"~") as the value for another dataset's query parameter it works and there is no error.
<DataSet Name="getReportInfoOnSelectedPerson"> <Fields> <Field Name="name"> <DataField>name</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> <Field Name="Building"> <DataField>Building</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> <Field Name="Unit"> <DataField>Unit</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> <Field Name="desc"> <DataField>desc</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> </Fields> <Query> <DataSourceName>myDataSource</DataSourceName> <CommandType>StoredProcedure</CommandType> <CommandText>Reports_BasicInfo</CommandText> <QueryParameters> <QueryParameter Name="@personID"> <Value>=Parameters!personID.Value</Value> </QueryParameter> <QueryParameter Name="@numberINeedToAggregateData"> <Value>=Join(Parameters!viewOption.Value,"~")</Value> <rd:UserDefined>true</rd:UserDefined> </QueryParameter> </QueryParameters> <rd:UseGenericDesigner>true</rd:UseGenericDesigner> </Query> </DataSet>
And I already said this, but the stored proc/dataset that throws the error uses a parameter with the same set up in about 5 other reports (I have tried copying and pasting the relevant code sections from working reports but I still get the error). So, what's wrong with this one?
A query parameter is passed to the data query engine to be incorporated into the SQL script's WHERE clause or some other part of the SQL that can accept parameters. A report parameter is passed to the report processor to be processed while the report is rendered on the client.
Hidden – parameter is not presented to end users when running the report, but the parameter can be passed into the report at run time and does show up when setting up subscriptions. Internal – similar to hidden except in addition to not being presented to users running the report, it cannot be passed in a run time.
Try changing the order of the parameters using the up/down arrows.
They should appear in the order of dependence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With