Skip to main content
Participant
August 19, 2022
Question

Excel Formula to Java in PDF Forms

  • August 19, 2022
  • 2 replies
  • 350 views

Hi All,

 

This is regarding an IF statement in excel to "translate it" in JavaScript for PDF forms.

I know this kind of question has been addressed so many times, however, all of the questions are with only 1 cell, whereas my case is a bit more complex.

This is the excel function as is:

=IF(B12="Ball",IF(C26=1,20,IF(C26=2,30,(C26-2)*5+40)),IF(B12="Rocket",IF(C26=1,10,IF(OR(C26=2,C26=3),15,20))))

As you can see there are multiple dependent cells and I can't seem to make it work in Java. 

Note: every cell name is a corresponding field in PDF form.

 

Your support will be highly appreciated.

Thank you,

Mihai

This topic has been closed for replies.

2 replies

Legend
August 19, 2022

Not Java, JavaScript. This may seem picky, but if you go searching the web for info on Java and Acrobat you will get nothing useful at all. You will need to use getField for each named cell (field). And IF needs to be written as a series of tests, rather than the one IF(cond,yes,no) form.

Participant
August 19, 2022

Corect, is Java Script, please excuse my typo. I believe it is clear that I have little knowledge on how to script this. I do know the same conditional in excell doesn't work in JavaScript and you have to break it down, I just don't know how as I have no knowledge of JavaScript. My work domain is totally different.

I managed to get the code for only 1 condition, but what I need is a bit more complex, as the result depends on a selection of 2 choices.

Can you help me?