How do I handle empty number fields/variables in C

2019-09-04 18:06发布

问题:

I have the following formula in my group footer, but am having problems with displaying 0 if sample_perc is empty; this value gets empty if #rt_sample_ordered is blank.

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

How do i print 0 when sample_perc is blank?

回答1:

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