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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Cannot Purge Value Stream / Thing logged data

Nicolas_HORST
6-Contributor

Cannot Purge Value Stream / Thing logged data

Hello,

 

I have some problems understanding / using the "PurgeAllPropertyHistory" of the Thing of which Iam trying to delete the logged data from.

 

The logged data are full numbers (1,2,3...)

 

What exactly is the startDate and the endDate? Does the "PurgeAllPropertyHistory" even care about which Date is being set here (It just has to be different I assume)?

 

Is it possible to delete ALL logged data without setting startDate and endDate?

 

I am trying to purge the data via a Mashup with a button that is connected to the "PurgeAllPropertyHistory" of my thing. I also tried to add startDate and endDate values per datePicker and the set it via Button


Best regards

Nicolas
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Nicolas_HORST.

 

It appears your issue was resolved via the case that was opened.  Answers to some of your questions are as follows:

  • PurgeAllPropertyHistory is used to purge all values of all the logged properties on a thing between the given dates.
  • The service expects a start and an end date
    • If no start date is specified, the service will execute from 1970
    • If no end date is provide, the service takes the run time  TimeStamp as end time and deletes all properties from start date to the run time
  •  If you are using a Mashup to pass the parameters to a service, we recommend making the parameters to the service as “Required” so that no data is accidentally removed.

Please let us know if this can be considered the solution to your case or if additional information needs to be posted here for the benefit of others in the community.

 

Regards.

 

--Sharon

View solution in original post

14 REPLIES 14

Hello @Nicolas_HORST ,

 

Value Stream is dependent on its Thing.

Running a purge on a Thing, will only clear out that Thing.

 

There are 3 different purges available on the Thing - PurgeAllPropertyHistory, PurgePropertyHistory and PurgeSelectedPropertyHistory.

  • PurgeAllPropertyHistory - purges all logged properties on the Thing
  • PurgePropertyHistory - purges a property that is logged (you need to give the name of the property that is logged)
  • PurgeSelectedPropertyHistory - purges a list of properties on the Thing (takes an Infotable input of the properties you want to purge)

 

With that being said, you need to give a start and end date or it won't purge/ delete your data.

When you call service PurgeAllPropertyHistory to remove all the data entries from a Thing using the Value Stream, make sure you also select the startDate and endDate, and also make sure the startDate is on the bottom and endDate is on the top.

 

Hope it helps,

 

Hello @Ciprian-Traian ,

 

Thank you for your reply.

 

I already tried every combination of start and end Dates that I can think of.. do I have to clear the Thing or the ValueStream? I think I tried clearing both but It seems like the data is still available (I am using a graph to see if its still there or not)

 

Would startDate be the date that is today and endDate is the date that I want to delete to or is it reversed?

 

Is there a way I can manually delete / see the data? Where exactly is it saved in the msql database?


Best regards

Nicolas

Hi @Nicolas_HORST ,

Mention endDate as current time( var currentDate = new Date() ); Keep the start date as it is (undefined) .

Hello @Ashritha ,

 

Thank you for your answer.

 

How do I set the current date as that variable? I am using the DatePicker tool from Mashup menu.

And how do I run it?

 

I have linked a button to "PurgeAllPropertyHistory"

endDate is given by datepicker via ViewMashup (date Today)

startDate is empty (undefined)

 

Ive attached a picture of the bond between those things

 

I am connected to ThingWorx Industrial Connectivity 8 (TW Foundation)

 

 


Best regards

Nicolas

Hi @Nicolas_HORST ,

 

Create a custom service

  • current time as variable
    • var variableDate = new Date();
    • Call PurgeAllPropertyHistory and provide the above variable as endDate

Hello @Ashritha  ,

 

Thank you for you reply.

 

I created a new Service in the thing as seen as in the picture "2021-01-05_PTC-Community_PurgeAllPropertyHistory_3"

 

In picture "2021-01-05_PTC-Community_PurgeAllPropertyHistory_2" you can see that ive added the service to the thing inside the mashup view but i cant seem to connect those two..

 

Is there anything that Im missing?

 

 


Best regards

Nicolas

Hi @Nicolas_HORST.

 

There are 2 options for binding the service:

 

1) Drag and drop, but this can be tricky if you have several services in the mashup

2) Use the configure service button

       a) Select currentTimeDate service from the Data pane in the mashup builder

       b) Click the Data Properties tab below

       c) In the upper right corner of that window, click the configure selected entity button (button with split arrow)

       d) In the configure bindings windows on the left, locate the date field that is returned by your service

       e) Click the drop-down arrow to the right of the field

       f) Select Add Target

       g) In the right window pane, click the Data tab at the top of the screen

       h) Locate PurgeAllPropertyHistory

        i) Expand the parameters section of the service if it isn't already expanded

        j) Place a check next to the endDate parameter

        k) Click Next

        l) Click Done

 

If you still have issues, I recommend that we open a case.  I will be happy to open one on your behalf if you desire.

 

Regards.

 

--Sharon

 

slangley
23-Emerald II
(To:slangley)

Hi @Nicolas_HORST.

 

If you were able to resolve your issue with help from one of the previous posts, please mark the appropriate one as the Accepted Solution for the benefit of others in the community.

 

Regards.

 

--Sharon

Hello @slangley ,

 

I am sorry for the late reply.

I already tried the first step (dragging and dropping the service (PurgeAllPropertyHistory) the thing of which I want to delete the data from. I linked it to a button and a date time picker but it didn't work...

 

Could you provide me with a pictured guide if there is any available? Maybe I did something wrong in setting the service / thing up..

 

 

Best regards

 

 


Best regards

Nicolas
slangley
23-Emerald II
(To:slangley)

Hi @Nicolas_HORST.

 

I think it would be best to open a support case to work through the issues you're having.  I will be happy to open one on your behalf with your approval.

 

Regards.

 

--Sharon

Hi @slangley, Thank you for your answer. If a support case would be the best choice then I would be happy if you'd open one for me. Best regards Nicolas HORST

Best regards

Nicolas

Hi @Nicolas_HORST.

 

Case 15740886 has been opened on your behalf.

 

Regards.

 

--Sharon

Hello @slangley 

 

Thank you very much

 

Best regards

Nicolas HORST


Best regards

Nicolas

Hi @Nicolas_HORST.

 

It appears your issue was resolved via the case that was opened.  Answers to some of your questions are as follows:

  • PurgeAllPropertyHistory is used to purge all values of all the logged properties on a thing between the given dates.
  • The service expects a start and an end date
    • If no start date is specified, the service will execute from 1970
    • If no end date is provide, the service takes the run time  TimeStamp as end time and deletes all properties from start date to the run time
  •  If you are using a Mashup to pass the parameters to a service, we recommend making the parameters to the service as “Required” so that no data is accidentally removed.

Please let us know if this can be considered the solution to your case or if additional information needs to be posted here for the benefit of others in the community.

 

Regards.

 

--Sharon

Top Tags