Skip to main content
cojelon1
Inspiring
Sep 4, 2025 9:56 PM UTC
Question

Operation into javascript

I am trying to convert this operation into a javascript that does not give me an error message thank you.

((NewValue - OriginalValue) / OriginalValue)

3 replies

Nesa Nurani
Community Expert
Community Expert
Sep 5, 2025 4:40 AM UTC

Before calculating check that 'OriginalValue' is not zero, because you can't divide by zero, something like this  as custom calculation script (not SFN) :

var orgVal = Number(this.getField("OriginalValue").valueAsString);
var newVal = Number(this.getField("NewValue").valueAsString);

if(orgVal == 0)
 event.value = "";
else
 event.value = (newVal-orgVal)/orgVal;
Translate
PDF Automation Station
Community Expert
Community Expert
Sep 5, 2025 12:34 AM UTC

What is the error message?

Translate
justlearn
Community Expert
Community Expert
Sep 5, 2025 12:24 AM UTC

@cojelon1 sorry, what are trying to 'convert this operation into a javascript' — a form?

Translate
m