我有以下命名为@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之前,它与它进行操作。并在报告上显示结果字符串。
现在我想在报表上放置一个SUMMARY结果字符串字段。这是不行的。
我试过在相同的公式中使用ToNumber()
以及一个新的公式:
numbervar fVal;
fVal := ToNumber({@newitemQuant}).
但没有进展。
我找到了答案。
基本上要处理报告中数字的小数数,只需右键单击该字段,选择格式对象->数字选项卡->在小数公式中->输入
If CurrentFieldValue = Int(CurrentFieldValue) Then
0
else
2
。其中2是您希望在任何情况下显示的最大小数数。
谢谢