Back

SyntaxError: Unexpected end of input

Published: Aug 19, 2024
Post Author Written by Pat Roth

Customer is running a map in SmartConnect.com and receives the error:

SyntaxError: Unexpected end of input

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.

Feeling stuck? Get the support and guidance you need to help you power through any data challenge

We're on your integration team. Connect with our people and let us know how we can help you.