cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Query property History

ishrivastava-2
1-Newbie

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.

5 REPLIES 5

Just using GetProperties or GetPropertyValues will get you that information.

Thanks Pai Chung for reply...

ankigupta
5-Regular Member
(To:ishrivastava-2)

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

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);

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.

Top Tags