• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Excel Formula to Java in PDF Forms

New Here ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript

Views

71

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

LATEST

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines