Skip to main content
Participating Frequently
June 26, 2023
Question

Converting IF Then statement from excel to PDF form

  • June 26, 2023
  • 1 reply
  • 2416 views

I have the statement IF(A>0, A-B, B) in a excel document that I need to use in a PDF form and do not know how to write the script. Any help would be greatly appreciated, thanks!

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
June 26, 2023

Try something like this:

var a = Number(this.getField("A").valueAsString);
var b = Number(this.getField("B").valueAsString);

if(a&&b){
if(a>0)
event.value = a-b;
else
event.value = b;}
else
event.value = 0;

 

Participating Frequently
June 26, 2023

Thank you! That worked.