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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Issue of SetPropertyValues for Value Stream

tallrain
12-Amethyst

Issue of SetPropertyValues for Value Stream

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.

ACCEPTED SOLUTION

Accepted Solutions

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);

 

 

 

View solution in original post

6 REPLIES 6
mgoel
17-Peridot
(To:tallrain)

@tallrain 

 

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

tallrain
12-Amethyst
(To:mgoel)

It's version 8.4.4

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);

 

 

 

tallrain
12-Amethyst
(To:smainente)

Thank you! Can you paste an example in JavaScript so I can try it in Thingworx Service?

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();

 

 

 

tallrain
12-Amethyst
(To:smainente)

Got it, thank you!
Announcements


Top Tags