Skip to main content
Participant
November 15, 2023
解決済み

Math Function to Java ind PDF Forms

  • November 15, 2023
  • 返信数 1.
  • 772 ビュー

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 

 

 

 

このトピックへの返信は締め切られました。
解決に役立った回答 Nesa Nurani

Did you change "Field A" to your actual field name?

What value did you type?

返信数 1

Nesa Nurani
Community Expert
Community Expert
November 15, 2023

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

 

Participant
November 15, 2023

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?

Nesa Nurani
Community Expert
Nesa NuraniCommunity Expert解決!
Community Expert
November 15, 2023

Did you change "Field A" to your actual field name?

What value did you type?