4 Replies Latest reply on Jan 14, 2018 8:54 PM by lgonzalez RSS
    lgonzalez Explorer

    Best practice to store set of XY values


    Every 10 minutes, my sensor uploads a set of XY values, for example: [4,2],[3,1],[2,1]. In this example my sensor uploaded 3 sets in one POST. But the amount of sets that is uploaded is not fixed, it can change in every upload. What is the best approach to store these sets, so that later I can query them, for example, retrieving the sets that were uploaded at an specific time?

    InfoTable? if so,  can i create historic data of infotables using a value stream? or shall this be written to a data table? I am confused with these two options.


    Thanks a lot in advance

      • Re: Best practice to store set of XY values
        keriw Apprentice

        H Luis,

        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.

          • Re: Best practice to store set of XY values
            lgonzalez Explorer

            Hi Keri,

            I have used before value streams and they work good for punctual values like, temperature, light intensity etc.

            But my data looks like this:



            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.