有空数据源时的公式错误 [英] formula error when having empty DataSource

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

问题描述

我在我的 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:

如果({PB_Portal_Reports_RestrictionRepClass.Amount}>0)那么t:= ToText({PB_Portal_Reports_RestrictionRepClass.Amount}) +" "+{PB_Portal_Reports_RestrictionRepClass.Currency}别的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

这里需要一个字符串.详细信息:文件 CollectionListReport {E78D7A32-A1D9-4C39-B11A-C333992049DC}.rpt 中的 errorKindError:公式 amn 中的错误:'如果({PB_Portal_Reports_RestrictionRepClass.Amount}>0)那么'这里需要一个字符串.详细信息: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

我尝试使用 isnull 或类型转换,甚至尝试先检查一些其他变量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

推荐答案

安德烈,

你为什么要在这里转换成文本?

Why are you converting to text here?

 t:= ToText({PB_Portal_Reports_RestrictionRepClass.Amount})

我认为你应该可以只使用

I think you should be fine with just using

t:=({PB_Portal_Reports_RestrictionRepClass.Amount})

试一试,如果它有效,请告诉我.

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

干杯,

克里斯

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

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