数据源为空时出现公式错误 [英] formula error when having empty DataSource

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

问题描述

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

I am using crystal reports in my asp.net application of vs2012. I have a formula in group of datasource that 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


这里需要一个字符串。
详细信息:File CollectionListReport {E78D7A32-A1D9-4C39-B11A-C333992049DC} .rpt:
公式amn中的错误:
'if({PB_Portal_Reports_RestrictionRepClass.Amount}> 0)then'
这里需要一个字符串。
详细信息:errorKind

A string is required here. Details: errorKindError in File CollectionListReport {E78D7A32-A1D9-4C39-B11A-C333992049DC}.rpt: Error in formula amn: 'if( {PB_Portal_Reports_RestrictionRepClass.Amount}>0)then' A string is required here. Details: errorKind

我尝试使用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?

 t:= ToText({PB_Portal_Reports_RestrictionRepClass.Amount})

我认为您只需使用

t:=({{PB_Portal_Reports_RestrictionRepClass .amount}) c

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

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

干杯

克里斯

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

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