Skip to Content

How to divide two numbers using JavaScript in Personas 2.0?

Hello everyone,

I have a field that displays a value in Volts and I need it to display in KiloVolts.

My idea is to divide the value by 1000 using JS and then display the result.

Dividing two numbers is a very simple thing in JS however Personas doesn't seem to allow any of the conventional ways.

I've tried multiple ways to do this. Examples -

ex1 -

args.thousand = "1000";

args.result = originalnumber/thousand;

ex 2 -

args.thousand = "1000";

args.result = Number(originalnumber)/Number(thousand);

ex 3 -

args.thousand = "1000";

args.result = parseInt(originalnumber)/parseInt(thousand);

and the like...

but nothing seems to work! 😔

If anyone can achieve any method in dividing two numbers, please share!

Thank you very much,

Saud.

PS: I am looking for a way in JavaScript. I am aware that it can be done by passing the numeric value to a WebRFC and fetching the result and displaying it. I am avoiding the usage of an ABAP RFC for something as simple as this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 16, 2015 at 01:49 PM

    Here's my script to do this:

    I wonder if you were just missing the "args." to reference the copied values inside the javaScript?

    Steve.


    Add comment
    10|10000 characters needed characters exceeded