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

# Acrobar Feldberechnung

New Here ,
Nov 15, 2022 Nov 15, 2022

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.2K

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 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;``````

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

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;``````

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

Copied

DANKE - Hallo, erhalte diese Fehlermeldung:

SyntaxError: missing ; before statement
7:Field:Calculate

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

Copied

What script does you use?

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

Copied

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

Copied

LATEST

Put the script at "Benutzerdef. Berechnungsskript"