Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi there,
Today I found an issue in Thingworx 8.4.
Here I have a Thing with 5 attributes(F1/F2/F3/F4/F5) with Value Stream configured.
Now I uses service of SetPropertyValues to update all attributes in the same moment.
- 1st time set to 11/12/13/14/15,
- 2nd time set to 21/22/23/24/25.
So there should be 2 rows in Value Stream.
But I found 3 rows instead, the 2nd update has been recorded into Value Stream in 2 different ms.
Impact:
In Analytics, if we set Dataset as time series data, the training model will track data back, by comparing current cycle VS last cycles, while for last cycles data are queried from Value Stream.
So if we cannot make sure all features/attributes are updated in the same moment(in same row of Value Stream), then the model will check with false data.
Please check it.
Solved! Go to Solution.
Hello,
This behavior is normal.
Try to use UpdatePropertyValues() instead and specify the same "time" for all the VTQ values in the InfoTable.
For example (java sdk ) :
InfoTable vtqs = ...;
final DateTime now = DateTime.now();
for (...) {
String name = ...;
BaseTypes type = ...;
Object value = ...;
final ValueCollection values = new ValueCollection();
values.put("name", new StringPrimitive(name));
values.put("time", new DatetimePrimitive(now));
values.put("value", BaseTypes.ConvertToPrimitive(value, type));
vtqs.addRow(values);
}
thing.UpdatePropertyValues(vtqs);
Thank you your post on ThingWorx community.
Let me try to reproduce this use case at my end. Could you please confirm you exact Thingworx version 8.4.x?
Regards,
Mohit
Hello,
This behavior is normal.
Try to use UpdatePropertyValues() instead and specify the same "time" for all the VTQ values in the InfoTable.
For example (java sdk ) :
InfoTable vtqs = ...;
final DateTime now = DateTime.now();
for (...) {
String name = ...;
BaseTypes type = ...;
Object value = ...;
final ValueCollection values = new ValueCollection();
values.put("name", new StringPrimitive(name));
values.put("time", new DatetimePrimitive(now));
values.put("value", BaseTypes.ConvertToPrimitive(value, type));
vtqs.addRow(values);
}
thing.UpdatePropertyValues(vtqs);
Sorry I don't have the JS service handy.
You can maybe re-use the snippet from this post : https://community.ptc.com/t5/ThingWorx-Developers/UpdatePropertyValues-service/m-p/523874/highlight/true#M18471
To get the current date in JS :
var now = new Date();