其他分享
首页 > 其他分享> > 我如何轻松否定MS报告中的表达式?

我如何轻松否定MS报告中的表达式?

作者:互联网

我正在将AF Crystal报告转换为MS报告.
我在Crystal报表中的表达是这样的:

=IIF(Fields!foo.Value Is Nothing and Fields!bar.Value Is Nothing,
0,
IIF(Fields!foo.Value Is Not Nothing and Fields!bar.Value Is Nothing,
Fields!foo.Value,
IIF(Fields!foo.Value Is Nothing and Fields!bar.Value Is Not Nothing,
Fields!bar.Value * -1,
IIF(Fields!foo.Value Is Not Nothing and Fields!bar.Value Is Not Nothing,
Fields!foo.Value,
0
))))

“否”在这里不起作用,甚至认为文本为蓝色.

我可以使用Not或类似的东西吗?还是必须对IsNothing()发疯

解决方法:

您应该可以将表达式简化为:

IIF(Not Fields!foo.Value Is Nothing, 
    Fields!foo.Value,
    IIF(Not Fields!bar.Value Is Nothing,
        Fields!bar.Value * -1,
        0))

编辑:要返回foo.Value-bar.Value都不为空时,请尝试:

= IIF(Not Fields!foo.Value Is Nothing, Fields!foo.Value, 0) -
  IIF(Not Fields!bar.Value Is Nothing, Fields!bar.Value, 0)

标签:visual-studio-2010,reporting-services,crystal-reports,vb-net,c
来源: https://codeday.me/bug/20191101/1986549.html