水晶报表公式中的计算错误 [英] Calculation Error in Crystal Report Fomula

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

问题描述

我有 2 个小数字段:GrossSalary 和 Deductions.在报表中,我创建了一个名为 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

我该如何解决这个问题?

How can I fix this?

推荐答案

如果 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.

在您的特定情况下,将值转换为 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天全站免登陆