Skip to main content
1-Visitor
September 25, 2019
Question

Purge ALL datatable entries within a time range

  • September 25, 2019
  • 1 reply
  • 4312 views

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
});

 

1 reply

22-Sapphire I
September 26, 2019

I believe that service is not a DataTable service but applies to ValueStreams

You can use: DeleteDataTableEntriesWithQuery

ague1-VisitorAuthor
1-Visitor
September 26, 2019

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!

22-Sapphire I
September 26, 2019

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!