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

Nested if function

New Here ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

Hi,

is it possible to create an if statement where fieldA is populated with a number if fieldB is filled in with a specific number, but if fieldB is filled in with that specific number and fieldC is filled in with a specific word the result in fieldA changes? 

TOPICS
Acrobat SDK and JavaScript , Windows

Views

235

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

correct answers 1 Correct answer

Community Expert , Mar 02, 2023 Mar 02, 2023

Sure, although you also need to specify what will be the value of the field in all other scenarios.

Use something like this:

 

var b = Number(this.getField("B").valueAsString);
var c = this.getField("C").valueAsString;

if (b==6) {
	if (c=="Apple") {
		event.value = "Something else";
	} else event.value = b;
} else event.value = "???";

Votes

Translate

Translate
Community Expert ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

Sure, although you also need to specify what will be the value of the field in all other scenarios.

Use something like this:

 

var b = Number(this.getField("B").valueAsString);
var c = this.getField("C").valueAsString;

if (b==6) {
	if (c=="Apple") {
		event.value = "Something else";
	} else event.value = b;
} else event.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
New Here ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

LATEST

Thank you, it worked!

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