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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Using "Sort" query on QueryPropertyHistory

nmilleson
17-Peridot

Using "Sort" query on QueryPropertyHistory

I'm attempting to use the "sort" query with QueryPropertyHistory but it is returning:

Error Executing Service

Unable to Invoke Service QueryPropertyHistory on dataHubThing : null

My query is:

{"sorts": [ { "fieldName": "flowRate" } ] }

If I use a "filter" it works just fine.  As soon as I try a sort, it returns the above message.

Instance is: ThingWorx 7.2.5-b56

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:nmilleson)

It looks like this indeed isn't working, please submit this as a bug on support.ptc.com

in the mean time you can use the Sort function after you've done querypropertyhistory

View solution in original post

6 REPLIES 6
PaiChung
22-Sapphire I
(To:nmilleson)

What does the full script look like?

I'm just testing the QueryPropertyHistory and manually entering the query into the "query" field.  No script. 

PaiChung
22-Sapphire I
(To:nmilleson)

It looks like this indeed isn't working, please submit this as a bug on support.ptc.com

in the mean time you can use the Sort function after you've done querypropertyhistory

Will do.  Thank you.  As a follow-up, the reason I want to sort is I'm having difficulties extracting all of the entries from QueryPropertyHistory and I wanted to view the effect of a sort that was passed as a parameter.  If I run QueryPropertyHistory from 00:00:00 to 00:30:00, I get entries that are timestamped anywhere from 00:00:08, to 00:29:55, which is correct.  However, if I increase the time window to 00:00:00 to 02:00:00, I get entries that are timestamped from 00:39:00 to 01:59:46.  I lose all of the entries from 00:00:08 to 00:39:00!  In order to view the data, I wrote a service that calls QueryPropertyHistory with oldestFirst as false and a maxRow parameter that is sufficiently large and then saves the entire table, row by row, into a dataTable (I know when you test QueryPropertyHistory you don't get the entire result in that window). 

Is there anything to do with that 500-limitation, that it returns only first 500 entries?

nmilleson
17-Peridot
(To:qcheng)

When I execute that custom service I output the length of the returned table from QueryPropertyHistory.  It's returning around 680 rows.

Top Tags