Ticket #29114
Question
I have a runtime calculation made in m-Painter keeps incorrectly rounding one of the arguments to the 3rd decimal point before it calculates. Here is my calculation: <@calc>EXPR[12,4,N]=(${row.ICOST_o} * ${grandTotal.IQTYOH_o}));</@calc> The expression is rounding the value of ICOST (ex. 0.7107) to 0.711 before evaluating, making the final result incorrect. How can I correct this?
Answer
Advised customer in her calculation to change this from: <@calc>EXPR[12,4,N]=(${row.ICOST_o} * ${grandTotal.IQTYOH_o}));</@calc> to <@calc>EXPR[12,4,N]=(${row.ICOST_o?string("0.####")}} * ${grandTotal.IQTYOH_o}));</@calc> The ?string("0.####") can be added to the field in the expression to force the format of the number to always display 4 decimal values for the field. For more on controlling the rounding of values in the HTML of your applications, feel free to check out this document from our website: https://www.mrc-productivity.com/docs/freemarker/html-edit-codes-to-control-data-rounding
Asked on June 11, 2019