AnsweredAssumed Answered

efficient connection pivalues with batches?

Question asked by bartmch on Jul 28, 2015
Latest reply on Jul 28, 2015 by bshang

Hi everybody,

I have the following nested loops:

 

For every UNIT (user-defined in input table)

- Get all batches within the user-defined start/end time window using PIUnitBatchSearch

- For every BATCH

--  Get the start/end time of the current batch

---  For every TAG (user-defined in input table)

---    Get the PIValues for the start/end batch time using PIPoint.Data.RecordedValues

----    For every PIValue

----    Write every value in a spreadsheet

 

This isn't really an optimal design as it is very slow. Is there any way I can pull all the batches along with their data from Pi in one go giving it a unit, tag, start/end date list?

I was thinking of pulling the batch list for a user-defined time window and the pivalues for that same window separately (two huge PI pulls instead of a lot of small pulls) and then joining them together (is there a specific PI function for this join?)

I've written this pseudocode in VBA, it would be great if you could include a VBA snippet supporting your answer.

 

Thanks in advance!

Bart

Outcomes