Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calculate with item values in JavaScript

Pavel_pJan 14 2015 — edited Jan 15 2015

Hi all,

I need to perform some calculations on a page and my users want to see the result immediately, so I cannot do it with PS/SQL. Let's assume that I just need to summarize two item values (PX_1 + PX_2) and set the result to the third one (PX_3). So the procedure could be something like create a JS dynamic action that affects the PX_3 item, JS code would be something like:

parseFloat($v('PX_1')) + parseFload($v('PX_2'))

So far so good, but unfortunately in my national settings we have space as a thousand separator and comma as a decimal character and I have to perform more complicated calculation with more than just two items. The question is if there is something more straightforward and user friendly than do it the hard way (e.g. take all the field values=>remove spaces=>replace "decimal commas" with decimal points=>perform calculations=>format the result according to our regional settings).

Maybe there is some jQuery or API function that can do the hard work for me and I'm just not aware of it. As there is quite a lot of "online calculations" in my app, any help will be highly appreciated.

Regards,

Pavel

This post has been answered by Pavel_p on Jan 15 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2015
Added on Jan 14 2015
5 comments
1,495 views