简体   繁体   English

如何使用基于SSRS中先前参数的下拉列表和文本框使用相同的参数?

[英]how to use a same parameter as a drop down and text box based on previous parameters in SSRS?

I have a report which has 3 parameters. 我有一个包含3个参数的报告。 Two date parameters which can accept NULL. 两个可以接受NULL的日期参数。 The third parameter should always be entered for the report to display. 应始终输入第三个参数以显示报告。 I want the third parameter to act as a 'Textbox' so a user can enter values when the first 2 parameters are NULL. 我希望第三个参数充当“文本框”,以便用户可以在前两个参数为NULL时输入值。 When the first 2 parameters are not NULL, the third parameter becomes a Dropdown selection. 当前两个参数不为NULL时,第三个参数将成为下拉列表选择。

I have created a dataset for the third parameter to feed on based on the 2 parameters - 我已经基于2个参数为第三个参数创建了数据集-

 IF @StartDate is NULL and @EndDate is NULL
 select NULL as ID
 IF @StartDate is not null and @EndDate is not NULL
 select ID from table when date between @StartDate and @EndDate

When I run the report with date parameters NULL, third parameter displays a blank textbox, but when I enter a value - it just displays blank report. 当我使用日期参数NULL运行报告时,第三个参数显示一个空白文本框,但是当我输入一个值时-它仅显示空白报告。 It looks like the report query is not overwriting the NULL value selected. 看起来报表查询没有覆盖所选的NULL值。

When I enter any value in the Batch ID parameter and click on "View report", it just returns blank page with 3rd parameter blank. 当我在“批次ID”参数中输入任何值并单击“查看报告”时,它将仅返回空白页,其中第三个参数为空白。 NO report is being displayed. 没有报告正在显示。

Any ideas to approach this scenario are appreciated.Thank you 任何解决这种情况的想法都将受到赞赏。谢谢

You can't have the third parameter be both an open textbox AND a single select drop-down list. 您不能使第三个参数既是打开的文本框又是单个选择下拉列表。 You'll need a fourth parameter for this. 您将需要第四个参数。

The dataset you shared will work for the drop-down, but you will need to have a default value other than NULL. 您共享的数据集将对下拉列表起作用,但是您需要具有除NULL以外的默认值。 In the parameter properties, set the Available Values to pull from this dataset. 在参数属性中,设置“可用值”以从该数据集中提取。

Add a fourth parameter that is a textbox. 添加第四个参数是文本框。 Allow blank values. 允许空白值。

In your main dataset you will need to handle these parameters either in the query or as dataset filters. 在主数据集中,您将需要在查询中或作为数据集过滤器处理这些参数。 For example, the end of your query could look like this: 例如,查询的结尾可能如下所示:

WHERE BatchID in @BatchIdList or BatchID = @BatchIdTextbox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何根据先前的下拉选择SQL填充下拉列表 - How to populate a drop down based on previous drop down selection SQL SSRS ..如何为同一服务器中的不同数据库创建下拉菜单 - SSRS ..How to create drop down menu for different databases in same server 根据下拉框选择填充文本框 - populate text boxes based on drop down box selection 根据下拉SSRS动态显示列 - Display columns dynamically based on drop down SSRS 如何通过在ssrs 2008中给一个通用标签设置两个下拉参数 - How to place two drop down parameters , by giving one a common label in ssrs 2008 如何通过在ssrs 2008中给一个通用标签设置两个下拉参数附近 - How to place two drop down parameters near by, by giving one a common label in ssrs 2008 如何使多值参数从ssrs报告中的下拉列表中选择或键入值 - How to make multivalue parameter to be selected from drop down or type values in ssrs report 查询以获取SSRS报告参数和下拉选项的速度较慢 - Query to get SSRS report parameters and Drop Down options slow 微策略:通过下拉框年份,如何在网格中显示所选年份和上一年的值 - Microstrategy: With a drop down box Year, how to show values of the selected Year and Previous year in a grid 如何在SSRS中使用多值参数 - How to use multivalue parameters in SSRS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM