We have few ProcessBook reports and we need to replicate the same functionality into a .NET web application. We are trying to implement a PI trend report in our .NET application.

We need to know how ProcessBook is collecting the tag data for a time range to show it in a trend chart. Is there any special logic of how the data is collected and interpolated in the ProcessBook trends ?

ProcessBook uses the PISDK's PlotValues function to fill in the data when it loads, then it signs up for updates from the update manager to continue to fill in data in the form of live updates.

Since you'll be using .NET, I would recommend the AFSDK, which also includes a PlotValues method. The number of intervals that we pass, as recommended by the AFSDK, is the number of horizontal pixels of the trend. Each interval will only contain a max of 5 values so that if you are trending a year's worth of data with millisecond precision on a 10 pixel graph, you don't receive 31 billion values despite being able to only render 10 of them; instead, you receive 50 and won't bog down the archive subsystem or display.

From there, the AFDataPipe allows you to get streaming updates as they happen, so you won't have to continually query in order to stay current.

Up to this point is just the data retrieval, though, and the graphing itself is left up to which trending object is being implemented. Whichever object type you end up using should have documentation on how to trend this data, but the AFSDK will be responsible for getting the data itself.

So ProcessBook generally uses the PI-SDK for data access (unless you are using one of the AF add-ins such as Element Relative Displays, or the AF2 add-in). For trends, the PI-SDK PlotValues() method is used to populate the data on a trend object.

If you are building a new custom .NET application, then you should be using either the AF SDK or the PI Web API for data access. Stay away from the PI-SDK, as it's marked for deprecation. Both the AF SDK and PI Web API provide equivalent PlotValues() methods that you can use.

Is there a reason why PI Vision doesn't meet your specific requirements for migrating your ProcessBook content to the web? Do they use VBA functionality that you need to otherwise replicate?