简体   繁体   English

SSRS-在参数表达式中指定值

[英]SSRS - Specifying Values in Parameter Expression

Good afternoon - 下午好 -

I am working Visual Studio 2013, attempting to build one (1) parameter which has different values assigned to each option. 我正在使用Visual Studio 2013,尝试构建一(1)个参数,该参数具有分配给每个选项的不同值。 I have created a data attribute which contains the following values: 我创建了一个数据属性,其中包含以下值:

  • Active 活性
  • Error 1 错误1
  • Error 2 错误2

I have specified the value in an expression for each option: 我已经在每个选项的表达式中指定了值:

  • All = "Active", "Error 1", "Error 2" 全部=“活动”,“错误1”,“错误2”
  • Active = "Active" 主动=“主动”
  • Errors Only = "Error 1", "Error 2" 仅错误=“错误1”,“错误2”

The only option that works is the Active option. 唯一有效的选项是“活动”选项。 The others return no records. 其他人不返回任何记录。

How should I define the expression? 我应该如何定义表达式?

Any and All assistance is very much appreciated! 非常感谢您的协助!

here is what you can do, you need to handle the query condition formatting and parameter values correctly. 这是您可以执行的操作,您需要正确处理查询条件格式和参数值。 eg see below example. 例如见下面的例子。

Dataset Query for Stored Procedure: 存储过程的数据集查询:

*declare @renderType nvarchar(max) *声明@renderType nvarchar(max)

declare @script nvarchar(max) 声明@script nvarchar(max)

--set @renderType = 'txt,dump' --set @renderType ='txt,转储'

SELECT @renderType = REPLACE(@renderType , ',', ''',''') SELECT @renderType = REPLACE(@renderType,',',''',''')

set @script = 'select render_format, subscriber_id from Sub_fact where render_format in (''' +@renderType+ ''')' 设置@script ='从Sub_fact中选择render_format,subscriber_id,其中render_format在('''+ @ renderType +''')'中

exec (@script);* exec(@script); *

create stored procedure to do all this formatting correctly. 创建存储过程以正确完成所有这些格式化。

now in parameter properties this is what i have provided 现在在参数属性中,这就是我提供的

在此处输入图片说明

this works perfectly for me. 这对我来说非常合适。 change your solution accordingly and it should work. 相应地更改您的解决方案,它应该可以工作。 respond with how it goes. 反应如何。

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

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