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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Retain property value on thing restart.

sbt
13-Aquamarine
13-Aquamarine

Retain property value on thing restart.

Hello,

I have a remotething with an average of 20 properties per remote thing and the no. of remote things can grow until 1000's. It is always recommended that a remote property is just logged but not persisted which adds up an extra operation to hold the value against each property.

If i have a thing restart, i loose all the property values and if for some reason the remote thing is not updated for a certain period of time and would like to retrieve the last values then its not available because its not persisted.

So what is the better approach to such kind of scenarios. 

 

Appreciate any support.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
yhan
17-Peridot
(To:sbt)

Yes, that's why the logged properties are called time-series data. The thing cannot receive the edge data during the time when it is restarted, so in this scenario, you can think it's a part of the restart that we keep the latest value before restarting, and properties will not be updated during this time period.

Of course, you can specify which properties need to get the previous value, according to your previous description, that the remote thing is not updated for a certain period of time and would like to retrieve the last values.

View solution in original post

6 REPLIES 6
yhan
17-Peridot
(To:sbt)

Assign or create a value stream for this thing, export this value stream before restarting the thing. You can import it if the properties' value cannot be queried after thing restarts.

sbt
13-Aquamarine
13-Aquamarine
(To:yhan)

sorry I didnt get your point. Yes i have a value stream associated to it, and as the property gets updated they are in the valuestream. So i just need the last property value updated to the stream which essentially i cannot get it from getpropertyvalues() because its refreshed over thing restart.

 

Thanks you.

yhan
17-Peridot
(To:sbt)

You can use QueryPropertyHistory() to get the latest values of logged properties.  For example, after thing restarts, execute below service (test and string is the name of my logged properties):

 

var infotable = me.QueryPropertyHistory();
me.test = infotable.test;
me.string = infotable.string;

 

Then property test and string will get their latest value before restarting.

sbt
13-Aquamarine
13-Aquamarine
(To:yhan)

Yes i completely agree with you, but just for an example if prop1 is updated with 10.0 at 12:00:00 and 20.0 at 12:00:30.

So now, on the value stream there are 2 values 10 and 20.

Now for whatever reason the remote thing restarts, and as per your case if i update the property from the history i.e. 20 which was the latest value for the property, It gets logged with 20 again.

Which means essentially now the value stream will have 10,20,20 which is ideally not a data from the edge but added by thingworx due to thing restart.

Is there a way that we can avoid this ingestion of dummy data. 

 

Thank you.

yhan
17-Peridot
(To:sbt)

Yes, that's why the logged properties are called time-series data. The thing cannot receive the edge data during the time when it is restarted, so in this scenario, you can think it's a part of the restart that we keep the latest value before restarting, and properties will not be updated during this time period.

Of course, you can specify which properties need to get the previous value, according to your previous description, that the remote thing is not updated for a certain period of time and would like to retrieve the last values.

sbt
13-Aquamarine
13-Aquamarine
(To:yhan)

Yes I agree. I think your point completely make sense. May be in my use case i have to see what other challenges i would have by implementing it.

Thank you for the support.

Top Tags