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 IIF语句缺少某些内容_Reporting Services_Ssrs 2008 - Fatal编程技术网

Reporting services IIF语句缺少某些内容

Reporting services IIF语句缺少某些内容,reporting-services,ssrs-2008,Reporting Services,Ssrs 2008,我的SSRS表达式已经超出了我的元素范围。我希望有人能帮我一把 我有两个名称字段: ContactName BusinessName 如果ContactName不为空,则仅使用ContactName。 但是,如果ContactName为空且BusinessName不为空,则使用BusinessName 我尝试了以下方法: =IIF(NOT Fields!ContactName.Value Is Nothing, Fields!ContactNam

我的SSRS表达式已经超出了我的元素范围。我希望有人能帮我一把

我有两个名称字段:

  • ContactName
  • BusinessName
如果
ContactName
不为空,则仅使用
ContactName
。 但是,如果
ContactName
为空且
BusinessName
不为空,则使用
BusinessName

我尝试了以下方法:

    =IIF(NOT
         Fields!ContactName.Value Is Nothing, 
         Fields!ContactName.Value, 
         Fields!BusinessName.Value
        )
然而,当我只有一个
BusinessName
时,它就不起作用了

当我只有一个
BusinessName
时,我需要做什么才能同时显示
BusinessName

作为更新:


答案是IIF语句和检查值是否也是空字符串的组合。

在SSRS中,ISNOTHING是一个需要参数的函数

您的表达式只需稍作更改即可将字段放入参数中:

 =IIF(NOT ISNOTHING(Fields!ContactName.Value), 
         Fields!ContactName.Value, 
         Fields!BusinessName.Value
        )

ISNOTHING是否也包含空值和空值?ISNOTHING仅适用于空值。您必须为空字符串(“”)添加另一个检查
NOT(ISNOTHING(Fields!ContactName.Value)或Fields!ContactName.Value=“”)
它使用这两个语句结束。现在它工作了!谢谢你的帮助!切换ContactName和BusinessName可能存在重复,请尝试
=IIF(无任何内容(字段!ContactName.Value),字段!BusinessName.Value,字段!ContactName.Value)