It's all about the answers!

Ask a question

What is the best way to represent dollars in RTC?


N. Dot (1321115) | asked Jan 09 '13, 6:42 a.m.
edited Jan 10 '13, 2:22 a.m. by Ralph Schoon (63.1k33645)
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



permanent link
Jared Russell (1.3k12019) | answered Jan 09 '13, 1:16 p.m.
 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
Millard Ellingsworth commented Jan 09 '13, 9:07 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER

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


Ralph Schoon commented Jan 10 '13, 2:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


Register or to post 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.