Copy link to clipboard
Copied
I am trying to do an if then statement on a PDF form.
The field is a calculated field A=C. If C>6 then C=5, else C=A
How do I write this in Adobe Pro on a PDF form?
Copy link to clipboard
Copied
Your description doesn't make much sense. Do you want to calculate the value of field A, or of field C?
And what does this mean? If C>6 then C=5
Do you mean: If A>6 then C=5 ?
Copy link to clipboard
Copied
Hi,
Sorry about the confusion in the explanation!
I wanted to calculate the value of field C, and I wanted the value of field C to equal the value of field A and if the value of field A is greater than 6 then I wanted field C to equal 6 (rather than 5) so:
A=C. If A>5 then C=5, else C=A
Copy link to clipboard
Copied
OK, that makes more sense... You can use this code as the custom Calculation script of C to achieve it:
var A = Number(this.getField("A").valueAsString);
if (A>5) event.value = 5;
else event.value = A;
Copy link to clipboard
Copied
Ok thank you!