水晶报告计算错误 [英] Calculation Error in Crystal Report Fomula

查看:162
本文介绍了水晶报告计算错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个十进制字段:GrossSalary和扣除。在报告中,我创建了一个名为NetSalary的公式字段,它是:

I have 2 decimal fields: GrossSalary and Deductions. In the report, I created a formula field named NetSalary, which is:

If Not IsNull({SalaryDetails.GrossAmount}) Then
 {SalaryDetails.GrossAmount} - {SalaryDetails.Deduction}

如果没有,我会收到以下错误

When data is available the report runs correctly, but if not I get the following error

A number, currency amount,date,time, or date-time is required here.
Details:errorKind
Error in File tempxxxxxxxxx.rpt:
Error in formula NetAmount:
'If Not IsNull({SalaryDetails.GrossAmount}) Then
'
A number,currency amount,date,time, or date-time is required here.
Details:errorKind

如何解决此问题?

推荐答案

如果Crystal Reports认为它使用的值不是数字,则会抛出此错误。 Crystal有许多转换函数,如(CDBL,CSTR等)以及可以使用的数据检查函数(IsNull,IsNumeric等)。

Crystal Reports will throw this error if it believes it is working with a value that is not a number. Crystal has many conversion functions like (CDBL, CSTR, etc) and also data check functions (IsNull, IsNumeric, etc) that you can use.

在您的特定情况下,将Crystal值转换为DBL(CDBL({field})可解决Crystal检查空值或空格后的问题。

In your particular case, converting the values to a DBL (CDBL({field}) solves your problem after Crystal checks for null values or blanks.

这篇关于水晶报告计算错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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