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

Soustraire une selection

After Effects: could not find dvaeve_dialogs.txt

Illustrator cs6 "Invalid Serial Number"