【问题标题】:Crystal Reports summary of a string field字符串字段的水晶报表摘要
【发布时间】:2011-12-07 03:07:33
【问题描述】:

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

但没有进展。 提前致谢

【问题讨论】:

  • 要对字符串字段进行什么汇总操作?

标签: string crystal-reports numbers summary


【解决方案1】:

我找到了答案。

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

If CurrentFieldValue = Int(CurrentFieldValue) Then
0 
else
2

完成。其中 2 是无论如何您要显示的最大小数位数。

谢谢

【讨论】:

  • 那行得通。我的公式将是多么浪费资源。你的让一切变得如此简单
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-06-13
  • 1970-01-01
  • 2021-11-17
  • 1970-01-01
  • 2023-03-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多