August 10, 20169 yr I am using a custom function to format a number into currency format ( two decimals ). RoundDecimals(11.0) = 11.00 The problems occurs when I use a variable: $amount = 11.0 RoundDecimals($amount) = 11.11 Similarly, I get the same error using a string: RoundDecimals("11.0") = 11.11 Is there any tricks to get around this issue ? This is the custom function that I used (I replaced the comma for a dot and defaulted second parameter to 2): https://www.briandunning.com/cf/974
August 10, 20169 yr You should not copy and paste code from people you don't know and use it without understanding how it works. Especially when those people don't understand it either. Have a look at (for example):http://fmforums.com/topic/73165-how-can-i-add-trailing-zeros-100-need-1000/#comment-437360
August 10, 20169 yr 18 minutes ago, comment said: You should not copy and paste code from people you don't know and use it without understanding how it works. Needing to understand how it works would defeat half the value of using someone else's code. Encapsulation is a beautiful thing. Edited August 10, 20169 yr by jbante
August 10, 20169 yr Author I agree with jbante. But of course, we have to make sure the source is reliable. 20 minutes ago, comment said: Have a look at (for example):http://fmforums.com/topic/73165-how-can-i-add-trailing-zeros-100-need-1000/#comment-437360 Thanks, this is much simpler and works like a charm !
Create an account or sign in to comment