## Adobe Community

• Global community
• Language:
• Deutsch
• English
• EspaÃ±ol
• FranÃ§ais
• PortuguÃªs
• æ—¥æœ¬èªžã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£
Dedicated community for Japanese speakers
• í•œêµ­ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Exit
• Betreff: Acrobar Feldberechnung

# Acrobar Feldberechnung

New Here ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Bin der abolute AnfÃ¤nger in bezgl. der Berechnung von Formularfeldern mit Java. Mein Problem: Ich habe ein eingabefeld "Distance" (Entfernung). Ja nach Entfernung < 300 (2,67) oder > 300 (1,50) muss ein anderer Wert gewÃ¤hlt werden. Ich habe folgende Formel in die Berechnung geschrieben: if(Distance<300,"2.67","1.50"). Dann kommt immer Fehler ")" fehlt, aber ich bekomme es nicht zum laufen - wer kann mir helfen? Danke & GruÃŸ

TOPICS
JavaScript

Views

1.5K

Report

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

## 1 Correct answer

Community Expert , Nov 17, 2022 Nov 17, 2022

Use this:

``````var dist = Number(this.getField("Distance").valueAsString);
if (dist == 0)
event.value = "";
else if (dist < 300)
event.value = 2.67;
else
event.value = 1.50;``````

Votes

5 Replies 5
Community Expert ,
Nov 17, 2022 Nov 17, 2022

Copy link to clipboard

Copied

Use this:

``````var dist = Number(this.getField("Distance").valueAsString);
if (dist == 0)
event.value = "";
else if (dist < 300)
event.value = 2.67;
else
event.value = 1.50;``````

Votes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

DANKE - Hallo, erhalte diese Fehlermeldung:

SyntaxError: missing ; before statement
7:Field:Calculate

Votes

Report

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

Copy link to clipboard

Copied

What script does you use?

Votes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Hello, I made a screenshot

Votes

Report

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

Copy link to clipboard

Copied

LATEST

Put the script at "Benutzerdef. Berechnungsskript"

Votes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
About Adobe Acrobat
Adobe Acrobat Feature & Workflow
FAQs