Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Math Function to Java ind PDF Forms

Community Beginner ,
Nov 15, 2023 Nov 15, 2023

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 

Felix33629182rkt8_0-1700045527861.pngexpand image

 

 

 

TOPICS
Windows
563
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Beginner , Nov 15, 2023 Nov 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?

Translate
Community Expert , Nov 15, 2023 Nov 15, 2023

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

What value did you type?

Translate
Community Expert ,
Nov 15, 2023 Nov 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 = "";

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2023 Nov 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2023 Nov 15, 2023

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

What value did you type?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2023 Nov 15, 2023
LATEST

Got it - my field was named "A" not "Field A" so I had to adjust it! thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines