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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Display last 3month data from valuestream on time series chart

moresvishal
4-Participant

Display last 3month data from valuestream on time series chart

Hi, I have one property for which I log data for every second in valuestream. I want to display last 3month data from valuestream on time series chart. What is approach I need to use?

I am new to Thingworx. Please help.

ACCEPTED SOLUTION

Accepted Solutions

Hi @moresvishal 

 

You can use 'QueryPropertyHistory' service in Thing and pass startDate and endDate input to fetch the last 3 month data

 

Velkumar_0-1696469824491.png

 

There are also other services like QueryNamedPropertyHistory (Only specified Property History will be fetched)QueryNumberPropertyHistory (Only Number DataType Property History will be fetched)

 

More Information - Accessing Value Stream Data Using Services (ptc.com)

 

Addition Information: If you want to store intensive time series data (like every second) you can use InfluxDB as a persistence provider which will improve the performance of the app - Using InfluxDB as the Persistence Provider (ptc.com)

 

/VR

 

 

View solution in original post

3 REPLIES 3

Hi @moresvishal 

 

You can use 'QueryPropertyHistory' service in Thing and pass startDate and endDate input to fetch the last 3 month data

 

Velkumar_0-1696469824491.png

 

There are also other services like QueryNamedPropertyHistory (Only specified Property History will be fetched)QueryNumberPropertyHistory (Only Number DataType Property History will be fetched)

 

More Information - Accessing Value Stream Data Using Services (ptc.com)

 

Addition Information: If you want to store intensive time series data (like every second) you can use InfluxDB as a persistence provider which will improve the performance of the app - Using InfluxDB as the Persistence Provider (ptc.com)

 

/VR

 

 

moresvishal
4-Participant
(To:Velkumar)

I use QueryNumberPropertyHistory but always get the last 500 record maxItems in the query are undefined. If I calculate maxItems using the start and end date, I get a script execution timeout errorPlease check the screenshot for QueryNumberPropertyHistory with maxItems undefined

 

dataforoneday.png

@moresvishal 

 

maxItems default value is 500. If it is undefined still query will return only 500 rows.

 

Based on the time difference between startDate and endDate, you can define maxItems that need to be retrieved from DB.

 

Since you are logging data for every second and only one property, 1 hour of data should contain 3600 rows.  For 3 Months of Data, you need to query 7776000 rows of data which going to take a lot of time and will timeout. 

 

To avoid timeout, you can retrieve a small chunk of data and merge it. For example, You can create a logic to retrieve data every 2 hours (7200 rows of Data ) & merge it. The only problem is it will make 1080 DB Query calls (which is also going to affect app performance)

 

My suggestion: If data is not critical, you can increase the logging interval and log data into Stream or directly to an external database (which I prefer personally) using a Timer Subscription. 

 

/VR

Announcements


Top Tags