将字符串转换为数字字段 [英] Convert string to number field
本文介绍了将字符串转换为数字字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据库字段,其数据类型是水晶报表中的字符串。如何将它转换为数值?
I have a Database field whose datatype is String in Crystal Reports. How can I convert it to a number value?
推荐答案
在Crystal中,您可以创建一个公式, code> ToNumber 函数。编写该字段可能包含非数字数据的可能性可能是个好主意,例如:
Within Crystal, you can do it by creating a formula that uses the ToNumber
function. It might be a good idea to code for the possibility that the field might include non-numeric data - like so:
If NumericText ({field}) then ToNumber ({field}) else 0
以转换报表中使用的查询中的字段的数据类型。
Alternatively, you might find it easier to convert the field's datatype within the query used in the report.
这篇关于将字符串转换为数字字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文