close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Any way to work with 3 decimal places internally and show rounded 2 decimal places?

Thread began 3/11/2010 5:18 am by jernej | Last modified 3/11/2010 12:03 pm by jernej | 1682 views | 4 replies |

jernej

Any way to work with 3 decimal places internally and show rounded 2 decimal places?

I have a problem. As I am adding some rules and each rule is rounding to 2 decimal places 8I have set 2 decimals in ecart) after added the values are not the same as if I would add both numbers (as they are a 3 decimal values) and round that to 2 decimals.

If i set 3 decimal places everything is ok except in eCart 4.5.2 shopping cart everything is on 3 places. What I need is that internal calculations would be done using 3 decimal places and the result would then be in shopping cart rounded to 2 decimal places, then the values would be correct.

is that possible, even with a "hack" in the code?

ASP here :-)

Jernej

Sign in to reply to this post

Jason ByrnesWebAssist

you can use the ASP round() function.


the round function takes 2 arguments, the number to round and number of decimal places.


in the context of displaying an eCart price:

<%=WA_eCart_DisplayMoney(BlueSkyMusic, WA_eCart_DisplayInfo(BlueSkyMusic, "Price"))%>




using the round function would look like:

<%=WA_eCart_DisplayMoney(BlueSkyMusic, round(WA_eCart_DisplayInfo(BlueSkyMusic, "Price"), 2))%>
Sign in to reply to this post

jernej

Yes I know I can use round, but then I have to change every money display I drop from binding. I have changed the function Display money and entered 2 as the decimals and used 3 as a global parameter. It works, until I reload GUI then obviously the change dissapear.

Btw: Is round with 2 decimals same as FormatNumber?

Sign in to reply to this post

Jason ByrnesWebAssist

There is no way of doing this globally except altering the display money function, but yes, if you edit eCart, you will have to re edit the format number function.

Format number is used to format the display of the number, it will force the number of decimals you tell it to display. This comes into play with round round numbers like 11. if you tell format number to use 2 decimals, it form at 11 as "11.00", whereas round(11, 2) will only return "11". Format number will perform the rounding function though.

Sign in to reply to this post

jernej

Thanx for the explanation. Out tax rule is 0.085 (8.5%) and I am allways having a hard time to round things. On some occasions I miss 1 cent :-( Because 0.085 is on 3 decimals and we have to show store output in 2 decimals there comes to rounding errors all the time.

Thank you again.

Sign in to reply to this post

Eric Mittman

This post has been deleted.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...