Solved

Numberformat in MX - parentheses for negative numbers

Posted on 2004-08-02
10
425 Views
Last Modified: 2013-12-24
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?
0
Comment
Question by:kjuliff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
10 Comments
 
LVL 35

Accepted Solution

by:
mrichmon earned 63 total points
ID: 11697786
( ) means to put the parenthesis around negative numbers

The C means center justification within the mask width

The ^ usually indicates the place the justification should occur.



Try

<cfset myvariable = 123>
<cfouput>
#NumberFormat(myvariable, "(999)")#
</cfoutput>
0
 
LVL 15

Assisted Solution

by:tim_cs
tim_cs earned 62 total points
ID: 11697790
It should be something like this.

#NumberFormat(numVar, '(___)')# where numVar is the number you want to format.  If this isn't working please post your code.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11697797
Notice that in the above examples that you provided the only difference is in the spacing.
0
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

 
LVL 1

Author Comment

by:kjuliff
ID: 11697831
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.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11697953
are you sure that the number is negative?  I have not had a problem with it in MX

0
 
LVL 1

Author Comment

by:kjuliff
ID: 11699196
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?
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11699463
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.
0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…

734 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