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

Custom Calculation Formula Not Updating Correctly

New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Hi. I am trying to add a custom calculation formula and I don't have much experience with these. I would like my form to automatically update one text field depending on what is added to another text field. For example, if 951000 through 954000 is added to DeptID I want Fund to autofill as 225 and if 956900 is added to DeptID I want Fund to autocalculate as 569.  If 957000 is entered in DeptID I want Fund to autofill as 570. I am using the custom calculation below and it works the first time I enter the DeptID but it doesn't update if I change the DeptID. And if I leave the DeptID blank it is keeping 569 in Fund.  What am I doing wrong? I am entering this code in the Fund custom calculation:

var DeptID=Number(this.getField("DeptID").valueAsString);

if(DeptID=956900) event.value=569; else if (DeptID=957000)event.value=570;else event.value="225";

TOPICS
Acrobat SDK and JavaScript

Views

28

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 , Aug 02, 2022 Aug 02, 2022

Change:

if(DeptID=956900)

To:

if(DeptID==956900)

And:

else if (DeptID=957000)

to:

else if (DeptID==957000)

Likes

Translate

Translate
Community Expert ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Change:

if(DeptID=956900)

To:

if(DeptID==956900)

And:

else if (DeptID=957000)

to:

else if (DeptID==957000)

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 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

LATEST

That worked - thank you so much!!

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