Copy link to clipboard
Copied
Hi all,
unfortunately my knowledge of Java Script is bareley zero.
I would help how to implement a Custom Calculation Script. The situation looks like this:
Field A is a Value in currency
Fiel B is the output field
B= If Fied A <2500€; A*0,015; If Field A<5000€; A*0,0,25; IF Field A>10.000€ B="Text"
Could you please help me? Best case woule be if i would be able to copy it here
2 Correct answers
Hi Nesa,
thx I copied the code it creates no errors but if i open the pdf and type a value into "field a" field b stays empty. Do you know why?
Did you change "Field A" to your actual field name?
What value did you type?
Copy link to clipboard
Copied
Use this:
var a = Number(this.getField("Field A").valueAsString);
if(a > 0 && a < 2500)
event.value = a*0.015;
else if(a >= 2500 && a < 5000)
event.value = a*0.025;
else if(a > 10000)
event.value = "Text";
else
event.value = "";
Copy link to clipboard
Copied
Hi Nesa,
thx I copied the code it creates no errors but if i open the pdf and type a value into "field a" field b stays empty. Do you know why?
Copy link to clipboard
Copied
Did you change "Field A" to your actual field name?
What value did you type?
Copy link to clipboard
Copied
Got it - my field was named "A" not "Field A" so I had to adjust it! thank you so much!

