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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Purge ALL datatable entries within a time range

ague
13-Aquamarine

Purge ALL datatable entries within a time range

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

 

8 REPLIES 8
PaiChung
22-Sapphire I
(To:ague)

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

You can use: DeleteDataTableEntriesWithQuery

ague
13-Aquamarine
(To:PaiChung)

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!

PaiChung
22-Sapphire I
(To:ague)

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!

ague
13-Aquamarine
(To:PaiChung)

So then I will assume that this screen shot, attached, is a bug, which PTC will fix. 

(blacked-out content is my datatable name)

Constantine
17-Peridot
(To:ague)

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

ague
13-Aquamarine
(To: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?

Constantine
17-Peridot
(To:ague)

Regarding your original question, you should follow @PaiChung advise and use the service DeleteDataTableEntriesWithQuery, which is defined on DataTables.

 

clipboard_image_0.png

ague
13-Aquamarine
(To:ague)

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.

 

Announcements


Top Tags