number format mask for 'blank' if zero number?

Posted on 2005-05-01
Last Modified: 2013-12-24
I need to use #numberforma(n,'')# to display numbers '9,999' - which works great ...
EXCEPT ... I need to display NOTHING (not zero!) IF the number 'n' is 0.

Is this possible? I've looked at the mask parameters and I don't see that option!

Question by:rcbuchanan
    LVL 7

    Accepted Solution

    <cfif num=NumberFormat(number)>  <!--- or with a mask, if needed --->
    <cfif num EQ 0>
       <cfset num="">
    LVL 48

    Assisted Solution

    by:Ryan Chong
    try like:


    <cfif isnumeric(n)>
      <cfif n eq 0>
          <cfset outputstr = #numberforma(n,'')#>
          <cfset outputstr = "">
      <cfset outputstr = "">

    <cfoutput>outputstr = #outputstr#</cfoutput>


    Author Comment

    nope. i was hoping i missed something with the numberformat mask!?
    oh well.
    LVL 7

    Expert Comment

    Definetly wrong answer from ryancys.  Original number and number after NumberFormat() can give different results for <cfif n EQ 0>

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now