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错误索引超出了数组的界限。(rsRuntimeErrorInExpression)_Reporting Services - Fatal编程技术网

Reporting services SSRS错误索引超出了数组的界限。(rsRuntimeErrorInExpression)

Reporting services SSRS错误索引超出了数组的界限。(rsRuntimeErrorInExpression),reporting-services,Reporting Services,我正在SSRS中构建一个报告,我得到一个错误提示:索引超出了数组的界限(rsRuntimeErrorInExpression) 我尝试了不同的表达来解决这个问题,但我无法让它工作。我目前有: =iif(LEN(Fields!Comment.Value) - LEN(REPLACE(Fields!Comment.Value, ",","")) > 3, Split(Fields!Comment.Value, ",")(3), Nothing) 有人能告诉我如何解决这个问题吗?这个错误与S

我正在SSRS中构建一个报告,我得到一个错误提示:
索引超出了数组的界限(rsRuntimeErrorInExpression)

我尝试了不同的表达来解决这个问题,但我无法让它工作。我目前有:

=iif(LEN(Fields!Comment.Value) - LEN(REPLACE(Fields!Comment.Value, ",","")) > 3, Split(Fields!Comment.Value, ",")(3), Nothing) 

有人能告诉我如何解决这个问题吗?

这个错误与SSR试图计算分割表达式有关,即使Iif条件为false

您可以使用嵌套的Iif来返回有效的索引值,如0,以使拆分始终工作,而不是将静态值3作为数组索引

=iif(
    LEN(Fields!Comment.Value) - LEN(REPLACE(Fields!Comment.Value, ",","")) >3
    , Split(Fields!Comment.Value, ",")(
        iif(
            LEN(Fields!Comment.Value) - LEN(REPLACE(Fields!Comment.Value, ",","")) >3
            ,3
            ,0
            )
    ) 
, Nothing
)

非常感谢,我试过了,效果非常好!