Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Having Difficulty in Preventing CF from Rounding Money Figures

New Here ,
Dec 13, 2015 Dec 13, 2015

I'm using CF7 (it might even be CF6.5).  My hosting administrator is vague; it's rented space. Because of this dilemma, many solutions are not pertinent, because the version is antiquated.  I cannot help this.


For now, though, my CF code is displaying all my pennies as whole dollars.  I have:


#dollarformat(rpr_srvc_hst_amt_)#


My CSS aligns the values to the right, but I'm not sure if it's affecting the $59.99 becoming $60.00 Also, I'd prefer to eliminate the dollar sign, and just have 59.99 and other similar values (i.e. 49.99, 19.99).  This may entail another function besides dollarFormat.  I tried NumberFormat, but it rounds off also.


Please help.

246
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 13, 2015 Dec 13, 2015

Use decimalFormat or numberFormat plus mask, for example,

<cfoutput>decimalFormat: #decimalFormat(49.99)#<br>

numberFormat: #numberFormat(59.99,"__.__")#</cfoutput>

Translate
Community Expert ,
Dec 13, 2015 Dec 13, 2015

Use decimalFormat or numberFormat plus mask, for example,

<cfoutput>decimalFormat: #decimalFormat(49.99)#<br>

numberFormat: #numberFormat(59.99,"__.__")#</cfoutput>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 13, 2015 Dec 13, 2015
LATEST

Apparently, the MS Access field, having been set to "Currency" as a datatype, will be displayed in CF, as a "Single" subdatatype (one of the MS Access Number Datatypes).  #NumberFormat(field,____.__')# will not display the pennies, however, DecimalFormat will display the pennies, but no dollar sign, even if the Access database field is set to Currency.  Preferring no dollar sign anyway, I like this.  I've not tried the mask using the dollar sign; I've just tried it without the dollar sign,  It's easier for potential customers to view the costs without the dollar sign, because they already know it will be in dollars.  This is a marketing method, used by some companies, to psychologically "simplify" the values/costs.  The dollar sign is thought to "appear to be more expensive" psychologically, adding "clutter."  My thank you for the DecimalFormat() function solution.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources