ThingWorx: Streams vs Value Streams Vs Data Tables

A ThingWorx stream is a list of activities from things or data associated with things. Data associated with things includes time series data and event-driven data.

Each Stream has a timestamp plus additional fields.

A stream can be thought of as a table structure with certain predefined fields and any number of user-defined fields. User-defined fields are defined using DataShape.

Streams are independent data stores and can access data continuously:

– Querying single column value returns entire row

– Remain most beneficial for non-Thing-driven models

– Scripts are required to write data to Streams

ValueStreams are also like streams, but they will store the data ‘flat’, because it does it in an automated fashion, while you have to script how to store the information into a regular stream.

Streams also work in an asynchronous way and are more suited for large number of entries.

You can set up a timer and subscribe to the timer event and every time timer emits the event we can log data in stream.

Value Streams store data from associated Thing’s property :

– Querying Thing’s property data only returns values for that property

– Scripts not required to write Thing property data to its Value Stream

– Most useful for Thing-driven models

A ThingWorx datatable is similar to a Relational Database (RDBMS) Table. A ThingWorx data shape defines the columns or fields of the data table. To use a data shape to define a data table, at least one of the fields in the data shape must be set as a primary key. This enables the update and delete functionality, as well as efficient querying of data.

DataTables are synchronous and support primary keys and indexing and are more suited for reference/lookup.

So generally anytime you are storing information over time, historical information, think Stream/ValueStream. If you need a more static reference table, think DataTable.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top