Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reporting services 将单个参数的多个值从SSRS传递到配置单元_Reporting Services_Hive - Fatal编程技术网

Reporting services 将单个参数的多个值从SSRS传递到配置单元

Reporting services 将单个参数的多个值从SSRS传递到配置单元,reporting-services,hive,Reporting Services,Hive,对上述问题有什么答案吗?。我也遇到了同样的问题: SSRS端的查询是: select * from xyz.test_table1 where f1 in (?) 在本例中,我的数据源是一个配置单元表。用户对参数的选择是一个多值参数,我希望将其替换为: where in ('value1','value2') 当执行查询时。但是,当查看配置单元端的查询执行时,会发现: where in ('value1,value2') 我怎样才能解决这个问题 从文档中可以看出,配置单元查询语言似乎支持公

对上述问题有什么答案吗?。我也遇到了同样的问题:

SSRS端的查询是:

select *
from xyz.test_table1
where f1 in (?)
在本例中,我的数据源是一个配置单元表。用户对参数的选择是一个多值参数,我希望将其替换为:

where in ('value1','value2')
当执行查询时。但是,当查看配置单元端的查询执行时,会发现:

where in ('value1,value2')
我怎样才能解决这个问题

从文档中可以看出,配置单元查询语言似乎支持公共表表达式

因此,类似于以下内容的工作应该是可行的:


如果您不想在所有数据集中都使用这种僵化的方式,那么您需要将这种逻辑封装到SQL Server表值参数的配置单元等价物中,可能是

在SQL Server中,函数的定义如下:

create function [dbo].[fn_StringSplit4k]
(
  @str nvarchar(4000) = ' '        -- String to split.
 ,@delimiter as nvarchar(1) = ','  -- Delimiting value to split on.
 ,@num as int = null               -- Which value to return.
)
returns table
as
return
     -- Start tally table with 10 rows.
 with n(n)   as (select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1)

     -- Select the same number of rows as characters in @str as incremental row numbers.
     -- Cross joins increase exponentially to a max possible 10,000 rows to cover largest @str length.
  ,t(t)   as (select top (select len(isnull(@str,'')) a) row_number() over (order by (select null)) from n n1,n n2,n n3,n n4)

     -- Return the position of every value that follows the specified delimiter.
  ,s(s)   as (select 1 union all select t+1 from t where substring(isnull(@str,''),t,1) = @delimiter)

     -- Return the start and length of every value, to use in the SUBSTRING function.
     -- ISNULL/NULLIF combo handles the last value where there is no delimiter at the end of the string.
  ,l(s,l) as (select s,isnull(nullif(charindex(@delimiter,isnull(@str,''),s),0)-s,4000) from s)

 select rn
          ,item
 from(select row_number() over(order by s) as rn
    ,substring(@str,s,l) as item
  from l
  ) a
 where rn = @num
  or @num is null;

明白了!为其他用户发布答案

以如下表达式提供查询(在SSRS中的查询下):

=“从xyz.test_表1中选择*,其中f1位于('”&Join(参数!参数值,',')&')

上述字符串操作转换为:

从xyz.test_表1中选择*,其中f1位于('value1','value2')中


注意:值1、值2这是用户选择的多值参数的值

您的确切问题是什么?您到底想用什么格式传递值,传递的原因是什么?SSRS端查询的可能重复项类似于xyz.test_table1中的select*,其中f1在(?)。在本例中,我的数据源是一个配置单元表。用户对参数的选择是一个多值参数,我希望在执行查询时将其替换为where in('value1','value2')。但是当查看配置单元端的查询执行时,它是where in('value1,value2)。我该如何解决这个问题?*但当我在配置单元端查看查询执行时,我个人对配置单元(value1,value2)不太熟悉,尤其是从SSR查询时。您的数据集脚本是否需要用配置单元查询语言编写?
create function [dbo].[fn_StringSplit4k]
(
  @str nvarchar(4000) = ' '        -- String to split.
 ,@delimiter as nvarchar(1) = ','  -- Delimiting value to split on.
 ,@num as int = null               -- Which value to return.
)
returns table
as
return
     -- Start tally table with 10 rows.
 with n(n)   as (select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1)

     -- Select the same number of rows as characters in @str as incremental row numbers.
     -- Cross joins increase exponentially to a max possible 10,000 rows to cover largest @str length.
  ,t(t)   as (select top (select len(isnull(@str,'')) a) row_number() over (order by (select null)) from n n1,n n2,n n3,n n4)

     -- Return the position of every value that follows the specified delimiter.
  ,s(s)   as (select 1 union all select t+1 from t where substring(isnull(@str,''),t,1) = @delimiter)

     -- Return the start and length of every value, to use in the SUBSTRING function.
     -- ISNULL/NULLIF combo handles the last value where there is no delimiter at the end of the string.
  ,l(s,l) as (select s,isnull(nullif(charindex(@delimiter,isnull(@str,''),s),0)-s,4000) from s)

 select rn
          ,item
 from(select row_number() over(order by s) as rn
    ,substring(@str,s,l) as item
  from l
  ) a
 where rn = @num
  or @num is null;