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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Query in Expression

pshashipreetham
17-Peridot

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.

Shashi Preetham
1 ACCEPTED SOLUTION

Accepted Solutions

@pshashipreetham 

 

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

@pshashipreetham 

 

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.

 

Top Tags