I’ve got a report that has several parameters, among them CompanyID. The available values come from a dataset with the Value field set to “Value” and the Label field set to “Label”. Not exactly Rocket Science. The query looks like this:
select null as Value, ' Any' as Label
union all
select CompanyID as Value, CompanyName as Label from core.Companies
order by Label
Ok, no surprises. When I run that query I get things like
1506 Amalgamated Steel
2341 Beson Industries
245 Carver Holdings
etc....
Looks fine. However, when I view the HTML generated in report viewer, the select element that is generated has ordered integers for values: 1,2,3,4 etc. so filtering the results by company ID isn’t working.
What could cause this? The query is returning the correct values, the values are being populated in the dropdown, the Value field for the param is set to the Value field from the query. They just don’t have the correct value in the select/option field.
I cannot reproduce this in reporting services, it is working exactly fine for me.
My query is similiar although I always want the value “All” or “Any” as you mentioned to be at the top of my list so users dont have to look for it. I also do not include null as a value, I translate null to the value 0:
This ensures the null is not included in the result list…then in my main query the query that pulls the data, when I want to filter for the company id or all I do this:
The report works fine and my select has the correct values…