Copy link to clipboard
Copied
Hi You fantastic debugger/educators!
Here is my script:
var vsupplycfm = Number(this.getField("SupplyCFMcalc").valueAsString);
var vexhaustcfm = Number(this.getField("iftheninflow").valueAsString);
var vnozzle = Number(this.getField("Nozzledropdown").valueAsString);
event.value = (13500*vnozzle) / (vsupplycfm+vexhaustcfm);
its a fairly simple calculation I want to run at the end. And here is what the javascript debugger says:
Exception in line 3 of function top_level, script Field:Calculate
TypeError: this.getField(...) is null
3:Field:CalculateException in line 1 of function top_level, script Field:Calculate
TypeError: this.getField(...) is null
1:Field:Calculate
But the other fields are working and have numbers in them and are not null. I checked spelling , capitals etc seem correct.
Copy link to clipboard
Copied
Check again. Try copying & pasting the field names from the field properties dialog into the JavaScript editor.
You should also check that the denominator (vsupplycfm+vexhaustcfm) does not evaluate to zero before attempting the division, which will happen if both of those fields are blank.