Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi,
I made a short simple code to call this method (AddStreamEntries ) in a test service and get this error when calling it:
ErrorCode(ca207d29-837d-4110-b096-a43f1299cee8), Cause(null), Reason(Access was attempted on a null reference variable.), Possible Resolutions(Remove the reference to the null variable within your extension code.)
var stream = Things["TestCBStream"];
var values = stream.CreateValues();
values.AddRow({name: "toto"});
stream.AddStreamEntries({values: values});
TestCBStream is just a simple Stream with a testShape which has only one field "name".
The output of the execute method (in the Composer, logged in as Administrator) says:
"Error executing service AddPermissionToSuperUser. Message :: Wrapped java.lang.NullPointerException - See Script Error Log for more details."
I tried add permissions to SuperUser everywhere, but it changed nothing. I read the article
Solved! Go to Solution.
Hi All,
Thanks for your responses. Finally, we discovered that the timestamp is the only thing required (with the values of course). For those who need help on how to use AddStreamEntries, have a look to the topic
https://community.ptc.com/t5/IoT-Tech-Tips/AddStreamEntries-snippet-service/td-p/533577
It will be very useful.
We also discovered that timestamp is very important in AddStreamEntry: if you call this service to fast (in the same millisecond), you will lost some entries. This behavior causes us a lot of consuming time.
Not sure but perhaps you need more field information in your infotable to use addstreamentries (plural)
tbh I've never used it, and I've heard that different folks have had issues with making this work.
But I would maybe try using the createinfotablefrom datashape for type Stream first and then fill in a row of information, possibly add values for all fields.
You'll need to use an infotable with StreamEntryWithValues datashape as the input to that service. The fields are:
sourceType,
values,
location,
source,
tags,
timestamp
The 'values' field will be your infotable that has the row of data you want to enter. The other fields are the stream metadata
Hope that helps
--Nick
Hi All,
Thanks for your responses. Finally, we discovered that the timestamp is the only thing required (with the values of course). For those who need help on how to use AddStreamEntries, have a look to the topic
https://community.ptc.com/t5/IoT-Tech-Tips/AddStreamEntries-snippet-service/td-p/533577
It will be very useful.
We also discovered that timestamp is very important in AddStreamEntry: if you call this service to fast (in the same millisecond), you will lost some entries. This behavior causes us a lot of consuming time.