Skip to main content
Participating Frequently
Apr 3, 2018 7:14 AM UTC
Answered

Stringabfrage

Hallo zusammen,
hätte mal eine Frage,

A =this.getField("Artikelnummer.0").value.toString;

if (A = "F.800.600") this.getField("Artikelbezeichung.0").value = "PM14/18 FFH 420-800/FFB 370-600",this.getField("Montagezeit.0").value=60, this.getField("Einzelpreis.0").value="103,83";

else if (A = "F.800.800") this.getField("Artikelbezeichung.0").value = "PM14/18 FFH 420-800/FFB 600-800",this.getField("Montagezeit.0").value=60, this.getField("Einzelpreis.0").value="116,73";

wenn ich dann in das Feld Artikelnummer.0 F.800.600 eingebe, werden die Felder nicht automatisch ausgefüllt. wo hab ich den Fehler gemacht?

mfg

This topic is closed to new replies. Start a new post to keep the conversation going.
Bernd Alheit
Bernd AlheitCorrect answer
Community Expert
Apr 3, 2018 4:30 PM UTC

Dann kommt im Debugger auch diese Meldung:

TypeError: this.getField(...) is null

3:Field:Calculate


Can you share the form?

19 replies

try67
Community Expert
Community Expert
Apr 3, 2018 2:11 PM UTC

This line is also incorrect:

A = this.getField("Artikelnummer.0").value.toString;

toString is a function. To use it you must call it, like this:

this.getField("Artikelnummer.0").value.toString();

Or simply use:

this.getField("Artikelnummer.0").valueAsString;

Translate
Bernd Alheit
Community Expert
Community Expert
Apr 3, 2018 8:41 AM UTC

You must use following:

if (      ) {

command;

command;

command;

} else if (        ) {

command;

command;

command;

}

Translate
Participating Frequently
Apr 3, 2018 1:48 PM UTC

Danke ich werde es gleich probieren

Translate
try67
Community Expert
Community Expert
Apr 3, 2018 8:07 AM UTC

The comparison operator of JS is " == ", not " = "...

Translate
Participating Frequently
Apr 3, 2018 8:15 AM UTC

Danke, aber das funktioniert auch nicht, z.B.: (A=="F.800.600")

Translate
try67
Community Expert
Community Expert
Apr 3, 2018 8:21 AM UTC

Each getField command has to be separate. You can't separate them with a

comma in the same line of code.

Translate