Totaling valuestream - JSON does not allow non-finite numbers problem
I`m going trough valuestream entries and filtering them and saving to infotable in a service.
Basicaly im totalling values between hour A to hour B on each day for a week.
Problem is I get error when i use:
Totall+= StreamValue;
Im getting error:
"Wrapped org.json.JSONException: JSON does not allow non-finite numbers. Cause: JSON does not allow non-finite numbers."
everythign works fine if I use Totall+=1 or Totall= StreamValue; but +=StreamValue makes a problem.
Code used:
var params = {
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: undefined /* DATETIME */
};
var data = me.QueryPropertyHistory(params);
var params = {
infoTableName : "InfoTable",
dataShapeName : "StorageDataShape_granicd"
};
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
var tableLength = data.rows.length;
var newEntry = new Object();
var Once=0;
for (var y = 0; y < 7; y++)
{
var Type1=0;
Once=0;
newEntry.timestamp=null;
for (var x = 0; x < tableLength; x++)
{
var row=data.getRow(x);
if(row.timestamp.getDay()===y && row.timestamp.getHours() >= FromHour && row.timestamp.getHours() < TillHour) //row.timestamp.getDay()==y
{
if(Once==0)
{
newEntry.timestamp=row.timestamp;
Once=1;
}
Type1+= row.LM; //problem line
}
}
newEntry.LM_Totall=Type1;
result.AddRow(newEntry);
}
me.Totallhours=result;

