Skip to main content
11-Garnet
February 24, 2026
Question

Thingworx DataBase-ValueStream

  • February 24, 2026
  • 2 replies
  • 57 views

We have an application that receives messages from mobile devices. Each message contains a device ID, a coordinate, and the timestamp when the coordinate was captured.

This data is stored in a Value Stream as a position history: ID, capture timestamp, coordinate.

The issue is that devices sometimes resend coordinates with a capture timestamp that already exists in the Value Stream. When this happens, ThingWorx overwrites the existing record instead of creating a new one.

Example:
At 10:00 AM, device 123 sends coordinate A,B with capture timestamp 10:00 AM → stored as:
123, 24/02/2026 10:00 AM, A,B

Later, at 5:00 PM, the same device sends coordinate C,D with capture timestamp 10:00 AM. ThingWorx replaces the previous record, resulting in:
123, 24/02/2026 10:00 AM, C,D

How can we prevent overwriting and instead store both records with the same capture timestamp?

2 replies

16-Pearl
February 26, 2026

On a Value Stream the primary key is the timestamp. You cannot change this behavior on. Same timestamp will overwrite the existing entry.

Regarding your scenario: Do you have one Thing for each device-id you mention? And each thing has a logged coordinate-property. And you set it when a new datapoint is received?

 

Some ideas:

- You could query if an entry already exists. If yes take the timestamp and add one millisecond and persist the new value.

But as ValueStream is written async into database, the query might result in not giving the expected existing entry - as it might have not been written to it yet

- Or maybe your device can send timestamp with millisecond to make chance smaller that it resends the exact ms again

- I used a normal Stream before for such cases, which - on postgresql - uses timestamp+source as primary key. And as source can be a random string, I just put thingName+uuid in it.

 

Depending on the interval of data being send as duplicate option 1 may be "okay".

18-Opal
February 26, 2026
My initial reaction — I would argue that ThingWorx behaves correctly and you need to fix your mobile app instead.

On the second thought — how do you write to Value Stream? Do you just set properties individually, or call some service? Trying to understand what you mean by timestamp — is it actual Value Stream record timestamp, or just a logged property of type DATETIME? If it’s the latter — it shouldn’t be “overwritten”, and you should be able to query all historical values.