Highlighted

Having Difficulty in Preventing CF from Rounding Money Figures

New Here ,
Dec 13, 2015

Copy link to clipboard

Copied

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.

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

Use decimalFormat or numberFormat plus mask, for example,

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

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

Views

128

Likes

Translate

Translate

Report

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

Having Difficulty in Preventing CF from Rounding Money Figures

New Here ,
Dec 13, 2015

Copy link to clipboard

Copied

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.

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

Use decimalFormat or numberFormat plus mask, for example,

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

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

Views

129

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 13, 2015 0
Adobe Community Professional ,
Dec 13, 2015

Copy link to clipboard

Copied

Use decimalFormat or numberFormat plus mask, for example,

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

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2015 0
EwokStud LATEST
New Here ,
Dec 13, 2015

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2015 0