You can use PI SDK and VBA to use the Recordedvalues function with the start and end time to retrieve out a list of archive values to output on the listbox. Do your timestamps for both tags coincide or are they different? If they are different, you will need to read out the timestamps from the tag that you want to use as the base tag and use these timestamps to do a TimedValues call to get the values for the 2nd tag.
Thank you for your replying my queries. Yeah i would like to retrieve data from 2 Trace at specified time interval. lets say the well test was conducted for 4 hours. I need to average this value and put it into Listbox as a one value.
How to retrieve the recorded value from the specified time interval, and give average value at Listbox?
You can use the Summary method of the PIData object.
Summary is used to retrieve a single summary type over the user specified time range. The method returns a PIValue whose Value property is the calculated summary, and whose TimeStamp property is the time at the end of the period. For minimum or maximum calculations, the time stamp is the time of the first minimum/maximum event. The ValueAttributes property of the PIValue contains additional information about the summary result. See the Remarks section for more details.
object.Summary StartTime, EndTime, SummaryType, CalculationBasis, AsyncStatus
The Summary method syntax has these parts:
Part Description object
An object expression that evaluates to a PIData object.
StartTime A Variant containing the start time of the evaluation period. See the Settings section for allowable values. EndTime A Variant containing the end time of the evaluation period. See the Settings section for allowable values. SummaryType
The type of summary desired. This is a value from the ArchiveSummaryTypeConstants enumeration.
CalculationBasis The method used to evaluate the stream of values. This is a value from the CalculationBasisConstants enumeration. AsyncStatus An optional PIAsynchStatus object. To monitor the progress of the call asynchronously, the caller creates this object and passes it to the call. The caller may then use the PIAsynchStatus object's events to track the call's progress, and to cancel it if desired. Not currently supported.
The ArchiveSummaryTypeConstants you should use is astAverage. For more information on this PI SDK method, you can look at the PI SDK reference file located at %pihome%\help\pisdk.chm
Is there any ways that i can use VBA code and progam it? Can you give some simple example on how to retrieve data from Trend/Trace from achieved data on specified time?