AnsweredAssumed Answered

VB Script file to pull in PI values

Question asked by SethCath on May 6, 2020
Latest reply on May 8, 2020 by Rick_Davin_3.0

Hi

 

I'm a bit new to this and I kind of know what I'm doing with PI Data Link in Excel

In Excel if I want to pull in yesterdays values of a single tag at 15m intervals then I use:

 

=PISampDat("\\{PI Server}\{tagname},"y","t","15m",1,"")

 

This give me values at 00:00:00, 00:15:00, 00:30:00, 01:00:00 and so on

 

I want to replicate the above in a VB Script file and output the tag values to a CSV file

 

I found some very good sample code here: VBS script to pull data from PI server 

but when i use the line: Set pvs = pt.Data.RecordedValues("*-1d""*"0""1, Nothing) 

 

I'm not sure what to change the values in brackets to

 

I tried Set pvs = pt.Data.RecordedValues("y""t"0""1, Nothing)  

 

which does give me midnight to midnight values for yesterday but the values seem to come out at random intervals ie 

 

starts at 00:07:59, 00:08:59, 00:17:59, 00:18:59, 00:22:59 etc

 

I'm looking for it at 15m intervals starting at 00:00:00 to 23:59:45

Can someone explain what the parameters mean and how i can get every 15m

 

Thanks in advance

Outcomes