but there are Streams, ValueStreams and DataTables
From the Digital Guide:
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.
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.
A ThingWorx data table 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.
Based on the above, I would suggest creating a property on your sensor thing that is populated with your XY values and having this automatically stored in a value stream on data change.
I have used before value streams and they work good for punctual values like, temperature, light intensity etc.
But my data looks like this:
Time Array 19:01 [[1,2],[3,5]] 19:11 [[1,2],[3,5],[1,2],[3,5]] 19:21 [[1,2],[1,2],[3,5]] 19:31 [[1,2],[1,2],[3,5]] 19:41 [[1,2],[1,2],[3,5],[1,2],[1,2],[3,5]]
The problem is that i dont know which data structure to use to store these arrays and how to store its historical information.
Thanks a lot.
I would store it as a string value in the value stream and then you can just parse to array when you want to use it.
var a = "[[1,2],[3,5]]"; -- would come from string value in value stream
var array = JSON.parse(a);
logger.debug("array length = " + array.length);
logger.debug("Array vAlue 0 = " + array);
logger.debug("Array vAlue 1 = " + array);