Crystal Reports字符串字段的摘要

时间:2011-12-07 03:07:33

标签: string crystal-reports numbers summary

我有以下名为@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}). 

但没有进展。 在此先感谢

1 个答案:

答案 0 :(得分:0)

我找到了答案。

基本上要在报告中输入您的数字中的小数位数,只需右键单击字段选择格式化对象 - >数字标签 - >在小数公式中 - >输入

If CurrentFieldValue = Int(CurrentFieldValue) Then
0 
else
2

完成。其中2是您希望以任何形式显示的最大小数位数。

由于

相关问题