Solved

Numberformat in MX - parentheses for negative numbers

Posted on 2004-08-02
10
424 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
  • 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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