Skip to main content
1-Visitor
May 31, 2019
Question

AddStreamEntries error :Wrapped java.lang.NullPointerException

  • May 31, 2019
  • 1 reply
  • 3970 views

Hi All,

I am facing "Wrapped java.lang.NullPointerException " error while trying to execute AddStreamEntries to add records to stream.

 TW Version 8.3

 

Please find below the code

 

var column = "FlowRate";
var params = {
t: result1 /* INFOTABLE */,
columns: column /* STRING */,
aggregates: "AVERAGE" /* STRING */,
groupByColumns: "date" /* STRING */
};
// result: INFOTABLE
//var resultAggregate = Resources["InfoTableFunctions"].Aggregate(params);
var result = Resources["InfoTableFunctions"].Aggregate(params);

var resultLength = result.rows.length;

//logger.warn(resultLength);
var Values = Things["FlowRateAverage"].CreateValues();
for (var m=0; m < resultLength; m++) {
var resultRow = result.rows[m];
var newValues = new Object();
newValues.date = resultRow.date;
newValues.FlowRate = resultRow.AVERAGE_FlowRate;
Values.AddRow(newValues);
}

result = Values;

var paramsForAddStreamEntryService = {
sourceType: undefined /* STRING */,
values: Values /* INFOTABLE*/,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
timestamp: new Date() /* DATETIME */,
tags: undefined /* TAGS */
};

Things["FlowRateAverage"].AddStreamEntries(paramsForAddStreamEntryService);

 

 

 

 

 

1 reply

1-Visitor
June 11, 2019

I've got the same issue. Checked everything I could think of. 

 

Anyone out there?

1-Visitor
June 12, 2019

But the problem it's on the AddStream or on Aggregator? please add a try/catch in both cases to check where it really fails.

plaban1-VisitorAuthor
1-Visitor
June 12, 2019

I have used try catch and logs the issue is with addStream.