I have a set of global fields plus regular table fields both of integer type. Nevertheless, when I attempt to reset the globals I’m getting a field type error from JavaScript.
At the beginning of the exercise, the two globals have values of “0”, and the test table fields have numerical values 1 and 22. No decimals or any other data entries.
Error message is:
Setting global with name 'gseven_id' / type 'INTEGER' with value of wrong type org.mozilla.javascript.Undefined@65b1bd
Did you also check that “forms.testAnalysis.sevenid” actually has a value when your script is arriving at line:
globals.gseven_id = forms.testAnalysis.sevenid;
Set breakpoint at beginning of this line, activate debugger, when arriving at breakpoint, copy paste “forms.testAnalysis.sevenid” into the evaluate panel of the debugger. Hit enter to evaluate.
Now that’s really startling. No change in code, but now it works.
I had commented out the two critical lines of the method to test alternatives, and now have restored the original coding that generated the type error. I’ve gone to the globals to double check type, didn’t change anything but I 'm more likely to have clicked OK rather than Cancel on exit. Only actions I can think of.
This also happened early on. Had a type error, then spontaneously in the midst of trying to figure out the problem it went away, then returned again. Couldn’t at the time figure out what I had done to cause the fix or what I did to remove the fix.
Puzzling. Working now and won’t play with it further.