5 Replies Latest reply on Jan 11, 2018 3:04 PM by pchung RSS
    ishrivastava-2 Explorer

    Query property History

    Hello,

    I have created a Thingshape which contains properties and it implemented by thingtemplate. I am creating 5 things dyanamically with implements this thing templates.These things implemented properties of thingtemplate and thingshape. I am updating properties by sending json data to each thing properties. Now i want to create the infotable which contains the last updated thing property at the top of table. Can anybody tell me how to get that? I have used query property history which is giving values of last created thing. But i want it to updated according to last updated property of any thing.

      • Re: Query property History
        pchung Collaborator

        Just using GetProperties or GetPropertyValues will get you that information.

        • Re: Query property History
          Ankit Gupta Ninja

          isha shrivastava, If I understand your query clearly. You can use GetImplementingThingsWithData for this requirement.

            • Re: Query property History
              ishrivastava-2 Explorer

              Thanks for the reply, GetImplementingThingsWithData  is used to get the current data updated in any of the thing properties. I have used QueryImplementingThingswithpropetyHistory so that I get the logged history data as well last updated value. But I m not getting the output when I used this into service. Can you suggest me what parameters are to be used to call this service.Or I should use some other service.

              var params = {
              oldestFirst: undefined /* BOOLEAN */,
              maxItems: undefined /* NUMBER */,
              endDate: undefined /* DATETIME */,
              nameMask: undefined /* STRING */,
              query: undefined /* QUERY */,
              maxDataItems: undefined /* NUMBER */,
              dataQuery: undefined /* QUERY */,
              startDate: undefined /* DATETIME */,
              tags: undefined /* TAGS */
              };

              // result: INFOTABLE
              var result = ThingTemplates["TT_UKInS_Home"].QueryImplementingThingsWithPropertyHistory(params);

            • Re: Query property History
              pchung Collaborator

              To actually get the data from the last updated Thing, you'll have to get a little more creative, you could use the DataChange event on a property to then trigger the writing of the property values and Source into another Stream or Session so you always get the values of the last Thing changed

              or you would have to go through all things, do a retrieval of their last recorded valuestream entry and then compare them and return the latest.