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

If / Then statement based on another field's value

Community Beginner ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Hi there,

 

I'm trying to create a form and want to add an If/Then statement, based on the value of another field within the form.


So, if the value of [field] = 1, then the value of the current field should = "X".

Does anyone know the syntax for that? (And I mean literally, if the value of a field = 1 then the value of the other field should be "X".

 

Thanks in advance for your help!

Views

6.6K

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 ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

which adobe app? animate? acrobat? something else?

Votes

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 Beginner ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

So sorry - Acrobat. 🙂

Votes

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 ,
Sep 10, 2022 Sep 10, 2022

Copy link to clipboard

Copied

It looks like an employee evaluation form. So, my guess is Acrobat, and I will move the thread to the Acrobat forum.

ABAMBO | Hard- and Software Engineer | Photographer

Votes

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 ,
Sep 10, 2022 Sep 10, 2022

Copy link to clipboard

Copied

Here you go:

if(this.getField("field").value == 1)event.value = "X";

Votes

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 Beginner ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Thank you! I appreciate it! 🙂

Votes

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 Beginner ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Hi Nesa,

 

I am trying the statement you provided (thanks again). However, I'm having this problem: On the Employee Review form, I need ONLY one specific box to contain an "X" based on the score they received for that category.  BUT, the X is appearing in all boxes UP TO that score number (i.e., if the employee rated a 3, the form currently shows an X in the box for "1", "2", and "3" where the X should ONLY appear in the box for "3". 


Here's the exact syntax I'm using;  

 

if(this.getField("field").value == 3)event.value = "X";     [this in the "3" field value box only - in the "2 field value field, the statement is:      if(this.getField("field").value == 2)event.value = "X";  same for fields 1, 4 and 5.

 

I can't figure out where I'm going wrong. Any ideas? Again, thanks so much for any guidance you can provide - this is clearly not my strong suit!

Votes

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 ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

That's because you use the same field name in your scripts.

My script was just an example since I didn't know your field names, so change "field" with your actual field name.

Votes

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 Beginner ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Thank you. I did update with the actual field names (see image attached). Is there an add-on to specify that if the value is not EXACTLY 1 (or 2 or 3, etc.), the field value should be NULL?

Votes

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 ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Remove all scripts you have and use this one as custom calculation script of "QATIL" field instead:

for(var i=1; i<=5; i++){
if(event.value == i)
this.getField("QA"+i).value = event.value;
else
this.getField("QA"+i).value = "";}

 

Votes

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 Beginner ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

Thank you. Unfortunately, now I'm completely lost. I tried using the script you provided as the custom calculation for the QATTL field, but now I get zero results. There are no scripts or calculations at all in QA1-QA5. 

 

I'm unclear as to how this script pulls in the data from the appropriate section in the form. The data should come from Page 1, question 1 "Quality of Work". The calculation to be performed is on Page 4 in the Overall Performance Assessment section, first row. 

 

Thanks again,
Donna Rae

Votes

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 ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

Perhaps I misunderstand something.

if field "QOW1" equal 1 then field "QA1" equal X else "QA1" should be empty?

if field "QOW2" equal 2 then field "QA2" equal X else "QA2" should be empty...etc for other fields?

 

If yes, then use this as 'Validation' script of each "QOW" field,

in "QOW1" field use this:

this.getField("QA1").value = event.value == "1" ? "X" : "";

 

in "QOW2" field use this:

this.getField("QA2").value = event.value == "2" ? "X" : "";

 

Same for other fields.

Here is your file where I already made changes, let me know if it's something else you looking for:

https://drive.google.com/uc?export=download&id=1ggzgI9jVp0mzxRxadpAF87GUrr--_TIN 

 

 

Votes

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 Beginner ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Thanks Nesa,

 

I tried the updated document, but it still doesn't seem to want to behave. Here is an example of what I need in the "Overall Performance Assessment" area.

Votes

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 ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

Votes

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 Beginner ,
Nov 11, 2022 Nov 11, 2022

Copy link to clipboard

Copied

LATEST

Thank you Nesa,

Unfortunately, when I changed the score given in the "Quality of Work" area (Page 1, Item 1), the change was not reflected in the "Overall Performance Assessment" on Page 4 (see image attached).

It's been so long since I've been able to get to this that I can't remember what we've tried. One final attempt, if you have time and don't mind:
Is there a simpler statement that can just say, "If the value from the Total Score column = 1, the X should appear in the first column for this row. If the value from the Total Score column = 2, the X should appear in the second column for this row," and so on?

Votes

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