Solved

Numberformat in MX - parentheses for negative numbers

Posted on 2004-08-02
10
419 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
OpenLDAP set password to expire 7 531
CGI takes almost 2 minutes to load using thttpd 20 43
Systems talking to each other 5 124
apply ddos protection on all network interface 2 87
A web service (http://en.wikipedia.org/wiki/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…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

16 Experts available now in Live!

Get 1:1 Help Now