Copy link to clipboard
Copied
I am trying to make a tax form into a fill in that will calculate. The problem I'm running into is that I have to make a custom calculation script and I've never done that before. Most of the forms i have to make are very simple.
line 1E (this is the line i'm putting the script in) shows (1A-1B+1C+1D)
Sometimes line 1C can be a loss (negative number) but when calculating the taxable income you cant use a loss, only zero or positive numbers.
So i believe i'd need an if/else statement something like
if 1C is < 0 then 1A-1B+0+1D
else 1A-1B+1C+1D
I just have no idea how to put it in as the custom calculation script.
I've read thru the forum but cant find anything dealing with this.
Thank you!
You'll need to use a custom calculation script to do that. Something like this:
var v1 = Number(this.getField("1A").valueAsString);
var v2 = Number(this.getField("1B").valueAsString);
var v3 = Number(this.getField("1C").valueAsString);
if (v3<0) v3 = 0;
var v4 = Number(this.getField("1D").valueAsString);
event.value = v1-v2+v3+v4;
Copy link to clipboard
Copied
You'll need to use a custom calculation script to do that. Something like this:
var v1 = Number(this.getField("1A").valueAsString);
var v2 = Number(this.getField("1B").valueAsString);
var v3 = Number(this.getField("1C").valueAsString);
if (v3<0) v3 = 0;
var v4 = Number(this.getField("1D").valueAsString);
event.value = v1-v2+v3+v4;
Copy link to clipboard
Copied
OMG! I COULD KISS YOU! (or pay you if you prefer lol)
That worked perfectly! Thank you sooo much!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now