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

Can't Get Calculated Field To Display Blank When A Related Field Is Left Blank

Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Need to display a blank unless v1 has a number entered. Currently v1 shows -30 with nothing entered. Please help. Thanks.

 

var v1 = Number(this.getField("AsFoundRow1").value);
var v2 = 30;
var v3 = (v1)+.0001;
var v4 = (v1)-.0001;
if (v1 ==""){
event.value = "";
}
if (v1 =>30)
{
event.value = (v3)-(v2);
}
if (v1<30)
{
event.value = (v4)-(v2);
}

TOPICS
Acrobat SDK and JavaScript

Views

61

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

correct answers 1 Correct answer

Community Expert , Dec 06, 2021 Dec 06, 2021

Try this:

 

var s1 = this.getField("AsFoundRow1").valueAsString;
if (s1=="") event.value = "";
else {
	var v1 = Number(s1);
	// rest of code goes here
}

Likes

Translate

Translate
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Try this:

 

var s1 = this.getField("AsFoundRow1").valueAsString;
if (s1=="") event.value = "";
else {
	var v1 = Number(s1);
	// rest of code goes here
}

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 Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

LATEST

Wow! Fast response and works perfectly. Learned something new today. Thank you try67.

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