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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.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报告中将t null值转换为零_Reporting Services - Fatal编程技术网

Reporting services 为什么不';在我的SSRS报告中将t null值转换为零

Reporting services 为什么不';在我的SSRS报告中将t null值转换为零,reporting-services,Reporting Services,我有以下的表达: =IIF(IsNothing(Fields!WellTestMeasLiqRate.Value) = true, CDec(0), IIf(Fields!WellTestMeasLiqRate.Value > 0, Fields!WellTestTotalGasRate.Value / Fields!WellTestMeasLiqRate.Value, CDec(0))) = Iif( Fields!Wel

我有以下的表达:

=IIF(IsNothing(Fields!WellTestMeasLiqRate.Value) = true, 
     CDec(0), 
     IIf(Fields!WellTestMeasLiqRate.Value > 0,
         Fields!WellTestTotalGasRate.Value / Fields!WellTestMeasLiqRate.Value, 
         CDec(0)))
= Iif(  Fields!WellTestMeasLiqRate.Value <=0, Cdec(0),Fields!WellTestTotalGasRate.Value) 
/ 
Iif(  Fields!WellTestMeasLiqRate.Value <=0, Cdec(1),Fields!WellTestMeasLiqRate.Value)
但是,IsNothing子句似乎没有捕捉到空值,因此,当我生成报告时,此字段将返回#VALUE


任何提示都将不胜感激

这类错误与SSRS表达评估有关

使用以下表达式:

=IIF(IsNothing(Fields!WellTestMeasLiqRate.Value) = true, 
     CDec(0), 
     IIf(Fields!WellTestMeasLiqRate.Value > 0,
         Fields!WellTestTotalGasRate.Value / Fields!WellTestMeasLiqRate.Value, 
         CDec(0)))
= Iif(  Fields!WellTestMeasLiqRate.Value <=0, Cdec(0),Fields!WellTestTotalGasRate.Value) 
/ 
Iif(  Fields!WellTestMeasLiqRate.Value <=0, Cdec(1),Fields!WellTestMeasLiqRate.Value)

=Iif(Fields!WellTestMeasLiqRate.ValueSSRS验证IFF表达式的两侧。因此,如果分母为0,则无论检查多少次,它都会给出#错误

您需要做的是在报表属性代码窗口中放置一个小函数

Public Function divide(Byval a As Decimal,Byval b As Decimal, Byval c As Decimal) As Decimal
'  Fix for divide by zero problem in VB
' calculates  a/b  and either returns result or c if b = 0 


if b = 0 then 
    return c 
else 
    return a/b 
end if 

end function 
然后使用此代码进行除法

这就是代码的调用方式

=code.divide(fields!numerator.value,Fields!denominator.Value,0.0)
报告是显示所有行的
#值
,还是仅显示空行?