Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello,
I am sending data to my Things. Those data are in an infotable like this:
my lastSession json looks like this:
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 ?
Solved! Go to Solution.
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
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