[英]Crystal Reports summary of a string field
我有以下名为@newitemQuant
公式:
WhileReadingRecords;
StringVar text := Totext ( {AR_SalesBySalesPersonDenim;1.quantity} , 6 , "" ) ;
NumberVar end := length ( text ) ;
NumberVar clip :=
(if Val ( text [ end - 6 to end ] ) = 0 then 1 else 0 ) +
(if Val ( text [ end - 5 to end ] ) = 0 then 1 else 0 ) +
(if Val ( text [ end - 4 to end ] ) = 0 then 1 else 0 ) +
(if Val ( text [ end - 3 to end ] ) = 0 then 1 else 0 ) +
(if Val ( text [ end - 2 to end ] ) = 0 then 1 else 0 ) +
(if Val ( text [ end - 1 to end ] ) = 0 then 1 else 0 ) +
(if Val ( text [ end - 0 to end ] ) = 0 then 1 else 0 ) ;
text [ 1 to Length ( text ) - clip ]
这基本上将我的数据库字段{AR_SalesBySalesPersonDenim;1.quantity}
(具有NUMBER数据类型)转换为STRING,然后再对其进行操作。 并在报告中显示结果STRING。
现在,我想在报表上放置一个汇总结果字符串字段。 无法实现。
我尝试在同一公式以及新公式中使用ToNumber()
:
numbervar fVal;
fVal := ToNumber({@newitemQuant}).
但是没有进展。 提前致谢
我找到了答案。
基本上是要处理报表中数字的小数位数,只需右键单击字段,然后选择格式对象->数字选项卡->小数公式->输入
If CurrentFieldValue = Int(CurrentFieldValue) Then
0
else
2
做完了 其中2是要在任何情况下显示的最大小数位数。
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.