Solved

Numberformat in MX - parentheses for negative numbers

Posted on 2004-08-02
10
412 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
Comment Utility
( ) 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
Comment Utility
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
Comment Utility
Notice that in the above examples that you provided the only difference is in the spacing.
0
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!

 
LVL 1

Author Comment

by:kjuliff
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

12 Experts available now in Live!

Get 1:1 Help Now