What is the best way to represent dollars in RTC?
N. Dot (13●2●11●15)
| asked Jan 09 '13, 6:42 a.m.
edited Jan 10 '13, 2:22 a.m. by Ralph Schoon (63.5k●3●36●46)
What is the best way to represent dollars in RTC? Is there a way to represent dollars and cents in RTC? What is the best way to do calculations on dollars and cents withing RTC? For instance, if you want to have an attribute that sums the number or hours by an hourly rate. Let's assume that the number of hours and hourly rate are displayed in two individual attributes while the sum would be displayed in a separate attribute.
|
One answer
If you're using RTC 4.x you can use the new decimal type to represent monetary amounts. To calculate the value for the sum field you can create a JavaScript attribute value provider which reads the values of the other two fields and then sets the value of the calculated field. I'm not particularly familiar with JavaScript but you should ensure that you don't lose any precision when performing the arithmetic.
Comments But do be careful to make sure that the returned value meets the Decimal field requirement (no more than 4 decimal places) or your script will encounter errors. Be sure to check the "API for JavaScript" section of the same article Jared linked: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript and there is also a wiki article with some examples: https://jazz.net/wiki/bin/view/Main/AttributeCustomizationExamples#Compare_decimal_attributes_in_pr In https://jazz.net/library/article/1093 Lab 5 that should be go online soon, we used string and validators. We wanted to be able to enter 8T for 8 thousand. However, the lab might provide some additional ideas. As mentioned the lab is about to be published to the Workshop.
|
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.