PixxUI.PITimedData

Description

Query for PI timed data. Note that you must have version 1.3.1 or greater of PI SDK in order to use this option.

Parameters

App As Application Tags() As String DiscreteTimes As Boolean
Servers() As String Dates() As Variant GoodOnly As Boolean
Users() As String FilterExpression As String MergeResults As Boolean
Passwords() As String Show As FilteredViewConstants  

Return Value

Result As Spreadsheet

SVB Example

' References required

' PixxAddin 1.0 Type Library (1.0)

' PISDK 1.3 Type Library (1.0)

' PISDKCommon 1.0 Type Library (1.0)

Option Base 1

Const g_nTags = 5

Sub Main

Dim PiConn As PixxUI

Set PiConn = AddIns.AddIn("PixxAddin.PixxUI.1")

Dim aServers(g_nTags) As String

Dim aUsers(g_nTags) As String

Dim aPwds(g_nTags) As String

Dim nItem As Integer

For nItem = 1 To g_nTags

aServers(nItem) = "PISERVER"

aUsers(nItem) = "piadmin"

aPwds(nItem) = ""

Next nItem

Dim aTags(g_nTags) As String

aTags(1) = "BA:ACTIVE.1"

aTags(2) = "BA:TEMP.1"

aTags(3) = "BA:CONC.1"

aTags(4) = "BA:LEVEL.1"

aTags(5) = "BA:PHASE.1"

Dim sTimes As Spreadsheet

On Error Resume Next

Set sTimes = PiConn.PICompressedData(Application,aServers,aUsers,aPwds,aTags,"y","t",btAuto,"",fvShowFilteredState,True,False)

If Err.Number <> 0 Then

MsgBox Err.Description

Exit Sub

End If

sTimes.Visible = True

Dim Vars As Variant

Dim nVars As Integer

If SelectVariables1(sTimes,"Timed Value Variable", 1, 1,Vars,nVars,"Variable containing date/time data") <> 1 Then

Exit Sub

ElseIf nVars <> 1 Then

Exit Sub

End If

Dim TimeStamps As Variant

Dim nbCases As Integer

Dim d As Double

nbCases = sTimes.NumberOfCases

TimeStamps = sTimes.GetData(1,nbCases,Vars(nVars),nVars,False)

ReDim TimeStamp(nbCases) As Variant

For i = 1 To nbCases

d = TimeStamps(i,1)

TimeStamp(i) = d

Next i

Dim s As Spreadsheet

Set s = PiConn.PITimedData(Application,aServers,aUsers,aPwds,aTags,TimeStamp,"",fvShowFilteredState,False,True,True)

If Err.Number <> 0 Then

MsgBox Err.Description

Exit Sub

End If

s.Visible = True

End Sub