我有一个包含多个参数的 SSRS (SQL Server 2008 R2) 报告。我遇到的问题是,首次加载报告时,其中一个参数并未始终选择其默认值。
具体来说,它在 BIDS 中工作正常,但一旦部署到 IIS 并在 IE 中查看,就会间歇性地工作(在一台服务器上工作,但在另一台服务器上不起作用)。我所说的间歇性是指它可以在我部署到的服务器上运行,但是当我将 RDS 文件复制到另一台服务器时,我的参数的默认行为被破坏。
详细信息
该参数具有“可用值”部分中指定的一系列指定(常量)整数值,这些值代表固定报告周期的选择。默认值具有单个指定值,该值与可用值之一匹配。
选项:数据类型整数,无空值,无多个值,参数可见,自动确定何时刷新。
有什么想法为什么我会看到这种行为吗?
I have an SSRS (SQL Server 2008 R2) report with several parameters. I'm having an issue where one of the parameters is not consistently choosing its default value when the report is first loaded.
Specifically, it works fine in BIDS but works intermittently (works on one server but not another) once deployed to IIS and viewed in IE. By intermittently, I mean it works on the server I deploy it to, but when I copy the RDS file to another server, the default behaviour for my parameter is broken.
Details
The parameter has a series of specified (constant) integer values specified in the Available Values section, which represent a selection of fixed reporting periods. The Default Values has a single specified value, which matches one of the Available Values.
Options: data type integer, no null values, no multiple values, parameter visible, automatically determine when to refresh.
Any ideas why I'm seeing this behaviour?
发布评论
评论(8)
确实如此,一旦将报表部署到服务器,参数就会在服务器级别进行控制。
然而,需要注意的一个事项是,如果您重新部署报告并更改默认值,它们将不会在服务器上更改!必须删除并部署该报告才能使新的默认设置生效。
如果您不想删除报表,则可以在报表服务器上手动更改默认值。
That is true, once the report is deployed to the server then the parameters are controlled at the server level.
Once item to note however is if you redeploy the report with changes to the default values THEY WILL NOT be changed on the server!!! The report must be deleted and deployed for the new defaults to take effect.
If you do not wish to delete the report then change the defaults by hand on the Report Server.
我已经找到了自己对这个问题的答案。我在这里为其他刚接触 SSRS 的人详细介绍一下,他们可能会对相同的行为感到困惑。这些参数可以与 RDL 文件分开管理,并且在将报表部署到服务器后可以覆盖默认值。要管理服务器上的参数:
I've discovered my own answer to this question. I'm detailing it here for anyone else new-ish to SSRS who might be confused by the same behaviour. The parameters can be managed separately from the RDL file, and defaults can be overridden once the report is deployed to the server. To manage the parameters on the server:
另一个无需删除报告的解决方案(删除报告时的问题是日志也被删除)是使用 ReportBuilder(Modifier dans le Générateur de rapports)打开新部署的报告。
只需保存报告,默认值就会更改。
Another solution without having to delete the reports (the issue when you delete the report is the logs are also deleted) is to open the new deployed report with ReportBuilder (Modifier dans le Générateur de rapports).
Just save the report and the defaults values will be changed.
假设您的报告名称是 xyz.rdl
如果您现在设置了默认参数并将其部署到服务器,则它在服务器上不会更改。
我建议3个选择
1.通过右键单击报告上的管理来更改服务器上的参数“Has Default”值
2.删除服务器上的报告并重新部署
3. 部署一个虚拟报告或同名的旧版本报告,如“xyz.rdl”,它没有此参数,这样做将删除服务器上的报告参数,报告保持不变。然后使用默认参数部署新版本报告,现在它应该可以工作了。
lets say your report name is xyz.rdl
if you have set default parameter and deployed it to server now, it will not change on the server.
i suggest 3 options
1. change the parameter 'Has Default' value on the server, by right click manage on the report
2. delete the report on the server and redeploy it
3. deploy a dummy report or old version report with same name say 'xyz.rdl' which doesn't have this parameter, doing this will erase report parameters on the server, report stays in tact. then deploy your new version report with default parameter, now it should work.
我有类似的问题。当报表已部署到“没有”默认值的服务器,并且您随后在 Visual Studio 中修改此报表并将相同参数更改为具有默认值时,服务器现在不会发现修改的报表具有默认值。
解决这个困境的方法是创建一个虚拟参数并将其放在列表的顶部。然后,我使用新的虚拟参数重新部署了该报告,并使用默认参数进行了相同的修改。这次,服务器发现我感兴趣的参数具有默认值。然后,我继续删除 Visual Studio 中的虚拟参数并重新部署该报告。我感兴趣的参数仍然保留默认值。
如果我选择了这条路线,我会阻止删除报告并添加订阅以解决我的困境。
I had similar issue. When a report has been deployed to the Server "Without" Default, and you subsequently modify this report in Visual Studio and change the same parameter to have a default, the server will not pickup that the modify report has a default now.
My workaround to this dilemma was to create a dummy parameter and put it to the top of the list. I then redeployed the report with the new dummy parameter and the same modified one with a default parameter. This time the server picked up that the parameter I was interested in as having a default value. I then proceeded to delete the dummy parameter in visual studio and redeployed the report. The parameter that I was interested in remained as having a default value.
I prevented deleting the report and adding subscriptions to it if I had went that route in order to fix my dilemma.
正确处理所有不同的场景需要做一些工作,但是(至少从 Sql Server 2012 开始)可以通过将 .rdl 文件加载为 xml 来更新脚本中的参数文件,并将其与 SSRS 管理 Web 参数
根据该比较,您可以使用 ReportingService2010.SetItemParameters 方法。
最后,存在一个连接问题“报告参数默认值在部署期间未更新”,其范围受到更多限制,仅允许自动更新参数默认值。
It takes a bit of work to correctly handle all the various scenarios, but it is (at least as of Sql Server 2012) possible to update the parameters from a script by loading the .rdl file as an xml file, and comparing it to the various settings available from the ReportingService2010.GetItemParameters method of the SSRS management web service
Based on that comparison, you can then update the parameters on the SSRS server using the ReportingService2010.SetItemParameters method.
Finally, there is a connect issue "Report parameter defaults not updated during deployment" that is a bit more limited in scope to allow just auto-updating parameter defaults.
我注意到这只是在更新静态参数值(
值“1”
)时出现的问题。 表达式参数值似乎可以很好地进行更新(Value "=iif(1=1, 1, 0)"
。下面包含屏幕截图示例。我建议或者,如果它是静态值,只需在管理器页面中输入该值即可。
另外,我通常使用 ReportServerTools powershell cmdlet,所以我不知道他们的部署是否可能在更新参数方面做得更好。因此,您可以尝试使用该工具而不是 Visual Studio 进行安装和部署。
Write-RsRestCatalogItem
参数 - “静态”与“表达式”
I have noticed this is only a problem when making updates to static parameter values (
Value "1"
). The expression parameter values seem to a good job of getting updated (Value "=iif(1=1, 1, 0)"
. Screenshot example included below.I would suggest using an expression. Or if it's a static value just type that in at the manager page. For example:
Also, I typically deploy my reports using the ReportServerTools powershell cmdlet, so I don't know if maybe their deployment does a better job with updating parameters. So you might try installing and deploying with that tool instead of from Visual Studio.
Write-RsRestCatalogItem
Parameters - "Static" vs "Expression"
删除整个报告并重新上传不适合我。我不会因此而丢失订阅和元数据。
相反,您可以使用以下 sql 清除数据库中存储的参数,然后重新上传报告,它将重新生成参数:
Deleting the whole report and re-uploading was not right for me. I cannot lose the subscriptions and meta data from doing this.
Instead you can clear the parameters stored in the Database with the following sql, and then re-upload the report in place and it will regenerate the parameters: