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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Log data only when wanted

AF_10328563
6-Contributor

Log data only when wanted

Hello,

 

I am sending data to my Things. Those data are in an infotable like this:

AF_10328563_0-1661416190708.png

my lastSession json looks like this: 

AF_10328563_1-1661416362360.png

 

However, sometimes I will send the same data but my lastSession will change but keep the same ID.
I want to log all my data. However, when a lastSession comes with the same ID as the old one, I want to replace the data and not log them.

I tried to PurgeSelectedPropertyHistory but it did not work.

 

Does anyone have an idea ?

 

1 ACCEPTED SOLUTION

Accepted Solutions

If you need to log with custom logic, I would suggest turning off the "logged" attribute on your Thing Property and writing a custom subscription that triggers on data change of that property.  Then you can decide whether to log that value to a stream or change the stream entry in place.  Keep in mind that this may force you to use Streams instead of the ValueStream since ValueStream entries cannot be modified (per https://community.ptc.com/t5/ThingWorx-Developers/Modifying-stream-entries/td-p/624867).

 

-Nick

View solution in original post

1 REPLY 1

If you need to log with custom logic, I would suggest turning off the "logged" attribute on your Thing Property and writing a custom subscription that triggers on data change of that property.  Then you can decide whether to log that value to a stream or change the stream entry in place.  Keep in mind that this may force you to use Streams instead of the ValueStream since ValueStream entries cannot be modified (per https://community.ptc.com/t5/ThingWorx-Developers/Modifying-stream-entries/td-p/624867).

 

-Nick

Top Tags