简体   繁体   English

基于其他参数的SSRS灰显参数

[英]SSRS grey out parameter based on other parameter

I have a parameter in SSRS where the user can select whether or not a provider is Terminated. 我在SSRS中有一个参数,用户可以在其中选择提供商是否已终止。 If they select Yes for Terminated then I want them to be able to select a Termination date range. 如果他们为“终止”选择“是”,那么我希望他们能够选择“终止”日期范围。 If they select No, then I want the date range to be greyed out. 如果他们选择“否”,那么我希望日期范围显示为灰色。 I found an answer for this elsewhere on the site, but I can't get it to work. 我在网站上的其他位置找到了答案,但是无法正常工作。 I got confused by what they meant by create a dataset based on the SpecifyDate dataset. 我对它们基于“ SpecifyDate”数据集创建数据集的含义感到困惑。 I tried to replicate this by creating a Terminated dataset, but I don't think I was doing this correctly. 我试图通过创建一个Terminated数据集来复制它,但是我认为我做的不正确。 This is what I found: possible solution 这是我发现的: 可能的解决方案

在此处输入图片说明

The Terminated parameter was created with this: 使用以下命令创建了Terminated参数: 在此处输入图片说明

The main dataset has a where filter: 主数据集有一个where过滤器:

    where status = @terminated

You cannot "Grey out" parameters in SSRS. 您不能在SSRS中“变灰”参数。 What you can do is set it to NULL. 您可以将其设置为NULL。 Your query needs to be able to handle NULL dates if Terminated parameter is set to "No". 如果“终止”参数设置为“否”,则您的查询需要能够处理NULL日期。

So what I would do is, create a dataset called Date which selects desired dates based on the Terminated parameter.. 因此,我要做的是创建一个名为Date的数据集,该数据集根据Terminated参数选择所需的日期。

The date dataset might look something like this: ( comment out the declare statement when implementing)-- I'm setting an arbitrary value for the termination dates 日期数据集可能看起来像这样:(在实现时注释掉声明语句)-我为终止日期设置了一个任意值

declare @teminated varchar(3) = 'Yes'
select
 case when @teminated = 'No' then getdate() else NULL end as start_date
, case when @teminated = 'No' then getdate() else NULL end as end_date

You would then set the default valued for the Termination dates form the dates generated in this dataset.. Hope that made sense. 然后,您可以从该数据集中生成的日期设置终止日期的默认值。希望这是有意义的。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM