Skip to main content
Participant
Aug 2, 2022 4:06 PM UTC
Answered

Custom Calculation Formula Not Updating Correctly

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";

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Aug 2, 2022 4:09 PM UTC

Change:

if(DeptID=956900)

To:

if(DeptID==956900)

And:

else if (DeptID=957000)

to:

else if (DeptID==957000)

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Aug 2, 2022 4:09 PM UTC

Change:

if(DeptID=956900)

To:

if(DeptID==956900)

And:

else if (DeptID=957000)

to:

else if (DeptID==957000)

Translate
Participant
Aug 2, 2022 4:57 PM UTC

That worked - thank you so much!!

Translate