数据源为空时出现公式错误

数据源为空时出现公式错误

本文介绍了数据源为空时出现公式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vs2012的asp.net应用程序中使用了水晶报表。
我在数据源
组中有一个公式,即:

I am using crystal reports in my asp.net application of vs2012.I have a formula in group of datasourcethat is:

if({PB_Portal_Reports_RestrictionRepClass.Amount}> 0)然后
t: = ToText({PB_Portal_Reports_RestrictionRepClass.Amount})+ + {PB_Portal_Reports_RestrictionRepClass.Currency}
else
t:= xxx;

if( {PB_Portal_Reports_RestrictionRepClass.Amount}>0)then t:= ToText({PB_Portal_Reports_RestrictionRepClass.Amount}) +" "+{PB_Portal_Reports_RestrictionRepClass.Currency}else t:= "xxx";

当我至少有一条记录,报告可以根据需要运行,但是当我通过记录数为0的列表时,就会出现错误

when I have at least one record the report is working as needed, but when I pass list with number of records =0, then I have an error

我尝试使用isull,或进行类型转换,甚至尝试首先检查其他变量 has_data,然后才尝试进行比较,但是仍然无法解决该错误,
请帮助我

I tried to use isnull, or type conversion, or even tried to check first some other variable "has_data" and only then try to do this comparision but still had no luck in solving this error,please help me

推荐答案

Andrei,

为什么要在此处转换为文本?

Why are you converting to text here?

 c 

尝试一下,让我知道它是否有效。

Give that a try and let me know if it works.

干杯

克里斯

这篇关于数据源为空时出现公式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 14:18