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

If If Then Statement

Community Beginner ,
Oct 04, 2019 Oct 04, 2019

Hello,

 

I'm trying to do something that's way over my head and would appreciate any and all help.  I want acrobat to look at a field and if that number is 1 or 2 or 3 and then another field and if that number is 800 or 900 or 1000 spit a fixed number into a third field.

TOPICS
PDF forms
2.2K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 04, 2019 Oct 04, 2019

Place this script as a "calculation" script into the 3rd field:

 

if (this.getField("FirstField").value == 1 && this.getField("SecondField").value == 800) {
event.target.value = 123456;} // where 123456 is the "fixed number"

 

else if (this.getField("FirstField").value == 2 && this.getField("SecondField").value == 900) {
event.target.value = 987654321;} // where 987654321 is the "fixed number"

 

else if (this.getField("FirstField").value == 3 && this.getField("SecondField").value == 1000) {
event.target.value = 657483920;} // where 657483920 is the "fixed number"

 

// etc.

else {
event.target.value = "";} // nothing


Acrobate du PDF, InDesigner et Photoshopographe

View solution in original post

Translate
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
Engaged ,
Oct 04, 2019 Oct 04, 2019

Hi Meriedel,

 

Here is a tutorial with examples on writing if statements-

https://acrobatusers.com/tutorials/conditional-execution

 

Hope this helps,

 

Dimitri

www.pdfscripting.com

Translate
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 Beginner ,
Oct 04, 2019 Oct 04, 2019
Thank you!
Translate
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 Beginner ,
Oct 04, 2019 Oct 04, 2019
Again, thank you, but I've already read that. I would really, really appreciate an example of code that looks at two fields and depending on the values in those two fields, auto populates a third. I'm not a programmer so this is really hard for me to do without seeing an example. Thank you again.
Translate
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 ,
Oct 04, 2019 Oct 04, 2019

Place this script as a "calculation" script into the 3rd field:

 

if (this.getField("FirstField").value == 1 && this.getField("SecondField").value == 800) {
event.target.value = 123456;} // where 123456 is the "fixed number"

 

else if (this.getField("FirstField").value == 2 && this.getField("SecondField").value == 900) {
event.target.value = 987654321;} // where 987654321 is the "fixed number"

 

else if (this.getField("FirstField").value == 3 && this.getField("SecondField").value == 1000) {
event.target.value = 657483920;} // where 657483920 is the "fixed number"

 

// etc.

else {
event.target.value = "";} // nothing


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 Beginner ,
Oct 04, 2019 Oct 04, 2019
Thank you so very much!!
Translate
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 ,
Oct 04, 2019 Oct 04, 2019
It should be event.value, not event.target.value .
Translate
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 Beginner ,
Oct 08, 2019 Oct 08, 2019
LATEST
Again, thank you so very much. I have one more question if you don't mind. What I'm really trying to do is not == but if above 801 and below 900, etc. I've tried all variations on <> and can't seem to get it. Any help is once again very much appreciated. Thank you.
Translate
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