Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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.
Solved! Go to Solution.
Hi @moresvishal
You can use 'QueryPropertyHistory' service in Thing and pass startDate and endDate input to fetch the last 3 month data
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
Hi @moresvishal
You can use 'QueryPropertyHistory' service in Thing and pass startDate and endDate input to fetch the last 3 month data
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
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 error. Please check the screenshot for QueryNumberPropertyHistory with maxItems undefined
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