Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Abs(Sum....) displays blank when zero

Status
Not open for further replies.

leadadmin

Technical User
Jul 23, 2003
20
US
In order to show only counts I have a report which displays only a group footer and page footer. One field in the group footer counts the number of times a field equals a given value. I am using the =abs(sum{fldname]="X")) expression. When the group count equals zero, on some lines it prints as "0" and on some it prints nothing (is blank). How can I always force a zero to display?

Thanks much for your help...
 
Try

=iif(isnull(abs(sum{fldname]="X"))),0,abs(sum{fldname]="X")))

Hope this helps.


Jim DeGeorge [wavey]
 
Thanks so much. That did it.

But now I have the same problem with a percentage calculation on those fields. This is what I have (using my old abs(sum) expression):

=Abs(Sum([fldname1]="Y"))/Abs(Sum([fldname2] Is Not Null))

where fldname1=0, fldname2=1.

Sometimes the zero result of this calc displays a "0" on the report, and on some records it is blank.

How can I force the "0" to print?

Thank you very much.

 
The "IIF" function is very powerful. The syntax is:

IIF(Your Expresssion, True Result, False Result).

Try to figure how to apply this to your new problem.

Jim DeGeorge [wavey]
 
you can use the "NZ" function. Assuming your variable is "X", you would use NZ(X,0). This returns the value of "X" if it's not null, and it returns 0 if the valu of X is null. You can substitute the 0 for any value or string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top