Customer is running a map in SmartConnect.com and receives the error:
SyntaxError: Unexpected end of input
What is the cause of this error and the resolution?
While this seems like it could be a source file issue because the Record Count is 0, this is actually a code issue in the JavaScript for this SmartConnect.com map.
if (month == 11) { if (!isNaN(parseFloat(this._CY11))) {nov += parseFloat(this._CY11);} if (!isNaN(parseFloat(this._CY12))) {dec += parseFloat(this._CY12); ///<-------missing closing brace here calc += nov + dec; }
In one of the very large calculations, there were multiple groups of code like the above to determine the resulting “calc” amounts.
In this case, the noted line of code was missing the required closing curly brace causing the braces to be “unbalanced” and the code to be incorrect. The javascript engine wasn’t able to pinpoint the actual cause and instead threw this generic error.
if (month == 11) { if (!isNaN(parseFloat(this._CY11))) {nov += parseFloat(this._CY11);} if (!isNaN(parseFloat(this._CY12))) {dec += parseFloat(this._CY12);} ///<-------Fixed, was missing closing brace here calc += nov + dec; }
After finding this and adding them missing curly brace, the calculation and map ran successfully.