Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Tags:
replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question