我目前正在尝试使用Visual Studio 2008附带的Crystal Reports创建报告。
我想在我的报告中包含一个类型为boolean的字段,该字段显示字符串而不是true或false。该字符串应包含€或%符号。
我将如何在公式工作坊中这样做?
我尝试了类似的事情。
if {tblAankoopDetails.SoortKorting} = true then "€" else "%"
然而,这似乎永远不会起作用并导致警告,例如“公式结果必须是数字”。
这应该相当简单,但这是我第一次使用Crystal Reports。
非常感谢帮助。
杰
答案 0 :(得分:2)
确保您的SoortKorting字段始终为true或false。也许有一个null,在这种情况下你的公式将不起作用。
试试这个:
if isnull({tblAankoopDetails.SoortKorting} ) then
" "
else
if {tblAankoopDetails.SoortKorting} =true
then "€" else "%"
答案 1 :(得分:1)
确保同一公式中没有其他内容。通常我会在公式有时返回字符串时看到特定的错误,有时候会返回一个数字。
此外,您不需要测试true,因此您可以尝试:
if {tblAankoopDetails.SoortKorting} then "€" else "%"