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

Query in Expression

psp316r
13-Aquamarine

Query in Expression

I am running the following code in the Expression, but there is no output from the Expression. Does QueryNamedPropertyHistory work in Expression?

DataTable = Things["ThingName"].QueryNamedPropertyHistory({
    propertyNames: {
        "rows": [{
            "name": "PropertyName"
        }],
        "dataShape": {
            "fieldDefinitions": {
                "name": {
                    "name": "name",
                    "aspects": {},
                    "description": "",
                    "baseType": "STRING",
                    "ordinal": 1
                },
                "description": {
                    "name": "description",
                    "aspects": {},
                    "description": "",
                    "baseType": "STRING",
                    "ordinal": 2
                }
            }
        }
    } /* INFOTABLE */ ,
    maxItems: undefined /* NUMBER */ ,
    query: undefined /* QUERY */ ,
    maxDataItems: 500000 /* NUMBER */ ,
    startDate: startDate /* DATETIME */ ,
    endDate: endDate /* DATETIME */ ,
    oldestFirst: true /* BOOLEAN */ ,
    dataQuery: undefined /* QUERY */
});
if(DataTable.rows.length === 0)
{
	Output = "No Data";
}
else{
	Output = " ";
}

 Thanks,
Shashi.

1 ACCEPTED SOLUTION

Accepted Solutions
SachinSharma
14-Alexandrite
(To:psp316r)

@psp316r 

 

I don't think the QueryNamedPropertyHistory service will run in the expression function. You can get the length of infotable returned by QueryNamedPropertyHistory in a separate service and pass its output to the expression function. Refer this article explaining all the tasks that can be performed with Expression.

 

View solution in original post

1 REPLY 1
SachinSharma
14-Alexandrite
(To:psp316r)

@psp316r 

 

I don't think the QueryNamedPropertyHistory service will run in the expression function. You can get the length of infotable returned by QueryNamedPropertyHistory in a separate service and pass its output to the expression function. Refer this article explaining all the tasks that can be performed with Expression.

 

View solution in original post

Announcements