Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
How do I purge any and all entries for a given datatable that are within a certain time range? I don't care what values may be contained within the time range - I will want to delete them, regardless.
I've tried these two out-of-the-box methods from PTC:
Things["MyDataTable"].PurgePropertyHistory({
propertyName: undefined,
endDate: myEndTimeStamp,
immediate: true,
startDate: myStartTimeStamp
});
...and......
Things["Ford.PFS.GM.Historian.Repository"].PurgeSelectedPropertyHistory({
propertiesToPurge: eventFramesInfoTable /* I passed an empty infotable here that was the same shape as my data table */,
endDate:myEndTimeStamp,
startDate:myStartTimeStamp
});
I believe that service is not a DataTable service but applies to ValueStreams
You can use: DeleteDataTableEntriesWithQuery
Those two services that I copied in my question are datatable services - I found them as out-of-the-box services associated with my datatable.
I'll try the query method you suggested and post the results here.
Thank you!
Just to clarify, all Things will have the ValueStream services like:
QueryPropertyHistory, QueryNumberPropertyHistory etc.
Those two you were trying to use, I'm fairly certain are part of that set.
If you look at the DataTable ThingTemplate, I believe they aren't part of that set of services.
Confusing I know!
So then I will assume that this screen shot, attached, is a bug, which PTC will fix.
(blacked-out content is my datatable name)
Hello,
It's not a bug -- you can put some logged properties on a data table, associate a value stream with it, and query / purge those properties via those services. They have nothing to do with the content of that data table though.
Regards,
Constantine
Very confusing - seems like not everyone is singing from the same song sheet. Oh well, it's not important - moving on.
Can someone please reply to my earlier post (above this one)? Pai seemed to cite a method which does not exist on data tables. What other method should I be looking for?
My original question: is there a way to purge any and all data table entries by time period, regardless of the content stored inside them?
Regarding your original question, you should follow @PaiChung advise and use the service DeleteDataTableEntriesWithQuery, which is defined on DataTables.
There seems to be no such service as you are referring to. I've taken a screen shot of what is available (attached).
** I also triple-checked that the entity in question is instantiating the 'DataTable' thing.