How do I calculate custom decimal attributes, that represent dollars, in RTC?
I am trying to calculate a total payment from several custom decimal fields, which the user inputs. If I just try to add the values, it appends the values together as if all the fields are strings. If I add the parseInt function?, it works a little better but the values get treated as integer. However, if I have to enter cents (which will be the case occassionally), the cents get dropped, as if they are not there. I'm not really a developer, but used to be ages ago, so I have some concept. I've been looking at other answers to related questions, but haven't found something that works. I'm hoping someone can tell me how to code the javascript to calculate decimals (monetary values). Here's my scripts so far. Note that authorPay, sdiFee, and prompt are all decimal attributes. And I'm returning to a decimal attribute.
dojo.declare("com.impediment.TotalPaymentCalculated", null, {
getValue: function(attribute, workItem, configuration) { var authPay = parseInt(workItem.getValue("authorPay")); var SDIfee = parseInt(workItem.getValue("sdiFee")); var promptPay = parseInt(workItem.getValue("prompt")); var totalAmt = authPay + SDIfee + promptPay; return totalAmt; |
Accepted answer
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.