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

Using QueryImplementingThingsWithNamedPropertyHistory

AndreaSteyn
11-Garnet

Using QueryImplementingThingsWithNamedPropertyHistory

Hi guys,

 

I am trying to generate a time series chart with a certain property from all the things of that template.   I am trying to write a service in a thing that will get the data required for the graph.  The service I have however returns all the properties and does not filter on the property infotable as expected.

 

Can anyone please assist with how I can achieve this? My service code is below.

 

//GetDataTrend
// today date
today = new Date();

// if no date specified
if (!StartDate){
StartDate = dateAddHours(today, -24);
}

if (!EndDate){
EndDate = today;
}

// create infotable to collect data
var params = {
infoTableName : "InfoTable",
dataShapeName : "EntityList"
};

// CreateInfoTableFromDataShape
var propInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

 

// EntityList entry object
var MotorSpeed = new Object();
MotorSpeed.name = "MotorSpeed"; // STRING [Primary Key]
MotorSpeed.description = undefined; // STRING

propInfoTable.AddRow(MotorSpeed);

 

// result: INFOTABLE dataShape: ""
var result = ThingTemplates["FELE.Dewater.BoreholePump.TT"].QueryImplementingThingsWithNamedPropertyHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
endDate: EndDate /* DATETIME */,
propertyNames: propInfoTable /* INFOTABLE */,
nameMask: undefined /* STRING */,
query: undefined /* QUERY */,
maxDataItems: undefined /* NUMBER */,
dataQuery: undefined /* QUERY */,
startDate: StartDate /* DATETIME */,
tags: undefined /* TAGS */
});

 

 

1 REPLY 1
PaiChung
22-Sapphire I
(To:AndreaSteyn)

I used to do this with the GetPropertyDefinitions service and then selected row.

It uses the following DataShape: PropertyDefinition ...

Still 'name' though but try with the CreateInfoTableEntryFromDataShape together with your CreateInfoTable

Top Tags