如何在Visual Studio 2013中在RDLC中使用表达式乘以表达式是否为字符串或空值 [英] How to Multiply using Expression in RDLC ignore if it has string or null values with visual studio 2013

查看:124
本文介绍了如何在Visual Studio 2013中在RDLC中使用表达式乘以表达式是否为字符串或空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将字段相乘(如果是1)时遇到问题,它是字符串.对于前.将Number * String乘以我得到的#error答案,它应该自动为0,但是在空值中,我有一个正确的函数,答案为0.如何解决我的问题?

Hi Im having a problem in multiplying the Fields if it is 1 field is string. For ex. Multiplying the Number*String I got #error answer, it should be automatically to 0 but in null values, I have a function correctly and the answer is 0. How to solve my problem?

这是我目前使用空值的代码:

Here is my code currently function with null values:

=Sum(IIf(Not IsNOthing(Fields!Unit.Value * Fields!Grade.Value), CDbl(Fields!Unit.Value * Fields!Grade.Value), 0)))

我也尝试过:

I have tried also:

=Sum(IIf(Fields!Unit.Value>0 And Fields!Grade.Value>0, CDbl(Fields!Unit.Value * Fields!Grade.Value), 0))

但是同样,在用Number * String进行乘法运算时也会出错.

but the same I got error in multiplying with Number*String.


推荐答案

我在将字段相乘(如果是1)时遇到问题,它是字符串.对于前.将Number * String乘以我得到的#error答案,它应该自动为0,但为空值

Hi Im having a problem in multiplying the Fields if it is 1 field is string. For ex. Multiplying the Number*String I got #error answer, it should be automatically to 0 but in null values

您需要分别测试每个字段.

You need to test each field separately.

=Sum(IIf((Not IsNOthing(Fields!Unit.Value) AndAlso Not IsNOthing(Fields!Grade.Value)), CDbl(Fields!Unit.Value * Fields!Grade.Value), 0)))


这篇关于如何在Visual Studio 2013中在RDLC中使用表达式乘以表达式是否为字符串或空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆