Hello Everyone,
We allow users to enter the amounts in the editable grid using the textbox component. (saving these values in the CDT decimal field)
And displaying the total amount and validating the total column against other values.
Values entered are :
430603.1013871.55117011.6523402.33
Would like to know why the sum function is not giving the value with the correct precision.
And also to calculate the sum with correct precision, do we need to use Fixed?
Discussion posts and replies are publicly visible
Explanation can be found here: community.appian.com/.../kb-1426-unexpected-results-on-decimal-calculations-and-rounding
Since it is a textbox field, the user can enter multiple digits after the decimal, and I need to save the number with precision 2.
To save the values in the local variable/cdt decimal field fixed(<<input value>>, 2) is the correct choice?
Perhaps this will help: docs.appian.com/.../recipe-define-a-simple-currency-component.html
No. fixed returns a string, not a decimal. The only correct way to reduce the number of decimal digits is by rounding.
My next question: Why do you use a text field in the first place?
We should display the user-entered amount separated by commas, so we used the text box to display the user-entered number using fixed.
Dot vs. comma decimal separator is defined by the user language.
Sorry, I didn't understand.
The amount will be entered in the text box.
To display, using fixed(amount, 2, false) in the value parameter of the text box.
Stefan Helzle said:Dot vs. comma decimal separator is defined by the user language.
I think the point is, you only get separators when displaying text ("1,000,000", etc).