Link to home
Start Free TrialLog in
Avatar of kjuliff
kjuliff

asked on

Numberformat in MX - parentheses for negative numbers

I cannot get numberformat to produce a negative number like (123)

I read http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/functa48.htm

and see
3.21
 C(__^__)
 "( 3.21 )"
 
3.21
 C__(^__)
 " (3.21 )"
 
3.21
 C(__^)__
 "( 3.21) "
 
3.21
 C__(^)__
 " (3.21) "
 


Can someone translate for me?
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrichmon
mrichmon

Notice that in the above examples that you provided the only difference is in the spacing.
Avatar of kjuliff

ASKER

That's what I thought but it doesn't print the parentheses in MX.

Here is the code

 <cfset formstring="<span style=""color:red;"">"   & #numberformat(tmpcalc, '(_999,999_)')# & "</span>">

I've tried leaving the underscores out. Still just get the number without parentheses.
are you sure that the number is negative?  I have not had a problem with it in MX

Avatar of kjuliff

ASKER

Yes. And now I see the problem but not how to get around it.

The code produces
   <td style=""font-weight:bold;"">(    9999)</span></td>

which is a cell in a table. It looks OK if saved as HTML and viewed in a browser but when saved as an Excel file the parentheses disappear! The number DOES show as negative though. But as -9999

Any ideas how to get it to display as (999) while keeping it as a numeric field?
That means NumberFormat is working properly.

You mean get it to display in Excel as (999) - not in the web.

You need to look into complex excel formatting through read-in files.  I am not sure you will be able to do that, but if it is possible it would be through setting cell styles when creating the xls file.

You will not be able to do it with a CSV file.