crystal 报告中的串联数字字段

Concatenated number fields in crystal reports

我在 crystal 报告中有 2 个数字字段,我想使用公式字段连接它们,因此在我的公式中我创建了一个字段并添加了 ToText({Table.TOTAL_QTY}) & " / " & ToText({Table.BOX_COUNT}) 作为公式。工作正常,但数字显示为小数,“9.00 / 12.00”。如何删除公式字段中的 0?

ToText 支持各种格式选项。当第一个参数为数字时,可以在第二个参数中传递小数位数:

ToText({Table.TOTAL_QTY}, 0) & " / " & ToText({Table.BOX_COUNT}, 0)

来自 Crystal 2008 年报告:完整参考资料:

ToText (n1, n2, s1, s2)
n1 – a numeric value to be converted to a string.
n2 – a numeric value indicating the number of decimal places to use when converting n1. This argument is optional.
s1 – a string value indicating the character or characters to use as a thousands separator when converting n1. This argument is optional.
s2 – a string value indicating the character or characters to use as a decimal separator when converting n1. This argument is optional.