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

FormatNumber hides zero 1

Status
Not open for further replies.

achmo

Programmer
Aug 30, 2001
56
IL
Hello,

On an asp page, I'm using the FormatNumber function to format data retrieved from SQL Server. Whenever the value formatted is zero, nothing is displayed (when I display the zero value without formatting it, it *is* displayed - it is not null).

Code:
intThisYear=rsMirpa(1)
-----some lines of code------
<td><font size=4><%=formatnumber(intThisYear,0)%></td>

if the value in inThisYear is 0, nothing is displayed in the cell; but if I just
use inThisYear without formatting, the zero values *are* displayed.

Does anyone have an idea what the problem is?

Thanks,

Yael
 
Hi,
Tested this interesting problem. But it seems to work here so I think the problem does not lie in the formatNumber() function. Could be somewhere else ... cheers. ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Visit --> for (Replica) Watches, Pen, Handbags, Hats, Jerseys and more ... at prices that makes your code spin ...
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
thanks for trying, anyway... For now, I just put
Code:
nbsp
in the beginning of the cell so that even empty cells look ok. But this is just a bypass, so I'll keep looking into it.

Yael
 
try this
<%=formatnumber(intthisyear,0,-1)%>
your server might have the includeleadingdigit part of the formatnumber automaticaly set to 0 (which determines whether a leading 0 is displayed for fractional values)
 
Great! It seems a simple zero is considered a leading zero, so it is not shown... Thanks!

Yael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top