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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula result won't show a zero 1

Status
Not open for further replies.

ChemistZ

Programmer
Oct 30, 2001
70
US
I have a formula that looks at a database field to see if it is equal to a certain value - if it is then it is supposed to multiply two other fields and it does this correctly and then at the end of the formula I say ELSE 0 but no zeros appear. Any ideas why? I tried checking the database field for no values and null values but still no zeros.
 
Right click on the field > Format Field > Number tab > Customize > look at the 'Show zero values as:' dropdown, and try setting it to '0'.

-dave
 
Man, I thought for sure that would be it but it still doesn't show zeros. WTF!!
 
Maybe a null. Having come to Crystal from mainframe languages, I got a 'cultural shock' when encountering null. It means 'no data': Mainframe languages mostly treat this as the same as zero.
It is actually a finer shade of meaning, the difference between 'Yes, we have no bananas' and 'I don't know how many bananas we have, it could be some, it could be zero'. In Crystal, the entry is 0 or null and can be tested for.
Note that Crystal assumes that anything with a null means that the field should not display. Always begin with something like
Code:
if isnull({your.amount}) then 0 
		         else {your.amount}


[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Jeez - all the blasted thing wanted was for me to check if it was null FIRST not second. THANKS for the good advice!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top