什么可能导致下拉列表(选择)忽略其值字段?
我有一个包含多个参数的报告,其中有 CompanyID。可用值来自值字段设置为“值”且标签字段设置为“标签”的数据集。不完全是火箭科学。查询看起来像这样:
select null as Value, ' Any' as Label
union all
select CompanyID as Value, CompanyName as Label from core.Companies
order by Label
好的,没什么意外。当我运行该查询时,我得到类似
1506 Amalgamated Steel
2341 Beson Industries
245 Carver Holdings
etc....
看起来不错的信息。但是,当我查看报表查看器中生成的 HTML 时,生成的 select
元素已为值排序整数:1、2、3、4 等,因此不能按公司 ID 过滤结果在职的。
什么可能导致这种情况?查询返回正确的值,值正在填充到下拉列表中,参数的值字段设置为查询中的值字段。 他们只是在选择/选项字段中没有正确的值。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法在报告服务中重现这一点,它对我来说工作得很好。
我的查询是类似的,尽管我总是希望您提到的值“全部”或“任何”位于我的列表的顶部,这样用户就不必寻找它。我也不包含 null 作为值,我将 null 转换为值 0:
这确保 null 不包含在结果列表中...然后在我的主查询中,当我想要过滤时,提取数据的查询公司 ID 或我所做的一切:
报告工作正常,我的选择具有正确的值...
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...