如何处理Crystal Reports中的空数字段/变量?

时间:2012-07-10 02:17:45

标签: crystal-reports formula isnull

我的组页脚中有以下公式,但如果sample_perc为空,则显示0时出现问题;如果#rt_sample_ordered为空,则此值为空。

NumberVar sample_perc := {#rt_sample_ordered}%{@sum_of_sample};
if (sample_perc>0)then
   sample_perc
else
  0

当sample_perc为空时,如何打印0?

1 个答案:

答案 0 :(得分:0)

If Isnull({#rt_sample_ordered}) Or Isnull({@sum_of_sample}) Then
  0
Else If ( {#rt_sample_ordered}%{@sum_of_sample} ) > 0 Then
  sample_perc
Else
  0