cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Adding values dynamically to a ValueStream

unnikrisvp
10-Marble

Adding values dynamically to a ValueStream

Hi I am trying to update values to my value stream using the Extension SDK. However the values are not getting changed on Thingworx.

 

InfoTableFunctions functions = new InfoTableFunctions();
InfoTable table = functions.CreateInfoTableFromDataShape(propertyName, propertyName+"Shape");
		
ValueCollection row = new ValueCollection();
for (Entry<String, Double> entry: dataMap.entrySet()) {
	row.SetStringValue(keyField, entry.getKey());
	row.SetNumberValue(valueField, entry.getValue());
	row.SetDateTimeValue("ds_timestamp", now);
	table.addRow(row.clone());
}
myThing.AddInfoTableValueStreamEntry(now, propertyName, table);
//mtConnectDeviceThing.setPropertyValue(propertyName, new InfoTablePrimitive(table)); // this works, but not sure if it will add to the stream.
1 ACCEPTED SOLUTION

Accepted Solutions
AdamR
12-Amethyst
(To:unnikrisvp)

mtConnectDeviceThing.setPropertyValue(propertyName, new InfoTablePrimitive(table));

 

This will work as long as your property is configured to be "logged".

 

Another question is why in the code snippet is one line trying to log to "myThing" and in the code above it is named "mtConnectDeviceThing".  Are these two different Things?


Thanks,

Adam

View solution in original post

2 REPLIES 2
AdamR
12-Amethyst
(To:unnikrisvp)

mtConnectDeviceThing.setPropertyValue(propertyName, new InfoTablePrimitive(table));

 

This will work as long as your property is configured to be "logged".

 

Another question is why in the code snippet is one line trying to log to "myThing" and in the code above it is named "mtConnectDeviceThing".  Are these two different Things?


Thanks,

Adam

Thanks Adam. I have added the 'isLogged' aspect to the Thing properties and it is working fine now.

 

The 'mtConnectDeviceThing' was a typo. I forgot to update it in the commented code.

Top Tags