[英]How can I specify values for parameters, when previewing a SSRS report in Visual Studio?
I have a SSRS report project (created by someone else) opened in Visual Studio, and don't know how to preview it.我在 Visual Studio 中打开了一个 SSRS 报表项目(由其他人创建),但不知道如何预览它。
In the dataset (.rsd file) of the report, it has a SQL script with two parameters: ConID and PayNo.在报表的数据集(.rsd 文件)中,它有一个带有两个参数的 SQL 脚本:ConID 和 PayNo。 So when I click "Preview" in the top left corner (right to "Designer"), I got the error "The ConID parameter is missing a value".因此,当我单击左上角的“预览”(“设计器”右侧)时,出现错误“ConID 参数缺少值”。 How can I specify values to the two parameters for previewing the report?如何为预览报告的两个参数指定值?
Here is my attempt, and let me know if I am in the right direction.这是我的尝试,如果我的方向正确,请告诉我。 I opened "Parameter Properties" of the first parameter, by right-clicking on "Contract Number" on the top left of the screenshot, and it shows its name is "ConID".我打开第一个参数的“参数属性”,右键单击屏幕截图左上角的“合同编号”,它显示其名称为“ConID”。
I am looking for where I can enter some value for this parameter, so I clicked "Available Values", then selected "Specify values", and then clicked "Add", and it asks me to type in "Label" and "Value".我正在寻找可以为这个参数输入一些值的地方,所以我单击“可用值”,然后选择“指定值”,然后单击“添加”,它要求我输入“标签”和“值” . But I don't know what "Label" means here.但我不知道“标签”在这里是什么意思。
Best way to get your report working is to take the script and run it directly in SQL without the parameters;让您的报告工作的最佳方法是获取脚本并直接在 SQL 中运行它而不使用参数; ConID and PayNo. ConID 和 PayNo。 In your unfiltered results, pick a ConID and PayNo value combination to run in your SSRS report.在未过滤的结果中,选择要在 SSRS 报告中运行的 ConID 和 PayNo 值组合。
For testing, change the parameters visibility to "Visible" (second to last screenshot) so you can adjust the parameter values without leaving Preview mode.为了进行测试,将参数可见性更改为“可见”(倒数第二个屏幕截图),这样您就可以在不离开预览模式的情况下调整参数值。 Now when you preview the report, those two parameter boxes should be blank and the report won't run until you provide values them.现在,当您预览报告时,这两个参数框应该是空白的,并且在您为它们提供值之前,报告不会运行。 Enter any ConID and PayNo combination from your unfiltered result set.从未过滤的结果集中输入任何 ConID 和 PayNo 组合。
If you want the parameters values to be populated when you run the report, you can enter them in the respective "Default Values" tab for each of the parameters .如果您希望在运行报告时填充参数值,您可以在每个参数的相应“默认值”选项卡中输入它们。 You do not need anything in "Available Values" tab.您不需要“可用值”选项卡中的任何内容。
Note - if this was a report in production, then it probably has it's parameters values passed by another report, which explains why the parameter visibility was set to hidden with no default values.注意 - 如果这是生产中的报告,那么它的参数值可能由另一个报告传递,这解释了为什么参数可见性设置为隐藏而没有默认值。 Make sure to revert back to those settings when you are done testing.完成测试后,请确保恢复到这些设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.