Help converting a basic Excel-style formula into JavaScript


i have self populating table in acrobat document; figured out of simple equations have 1 more complicated 1 needs javascript , know nada.

 

the reader inputs 2 values (a), (b)

 

and if write fomula in excel write:

 

=a-(if(b<20.5,b,20.5))+41.5

 

any thoughts on how translate this?  thanks!

if want custom calculation script field, be:

 

// custom calculation script text field

(function () {

 

    // field values, numbers

    var = +getfield("a").value;

    var b = +getfield("b").value;

 

    // set field's value

    event.value = - (b < 20.5 ? b : 20.5) + 41.5;

 

})();

 

but replace "a" , "b" in getfield statements actual field names you're using.



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Adobe Refresh Managerについて

Error during signature verification. Signature contains incorrect, unrecognized, corrupted or suspicious data. Support Information: SigDict /Contents illegal data