|
|
Rank: Newbie Groups: Member
Joined: 5/4/2009 Posts: 2
|
Hi,
I am trying to get the list of all tags, whose values are 'Scan Off'. I am looping through the RecordedValues & trying to read the Value or it's Type, but it's returning 'System.__ComObject'.
'Scan Off' is a 'System Digital Set' but not able to trace it. Is there a special way I can trace these tags with a value or set 'Scan Off'. ======== * If any PI Point is removed from the interface while the interface is running (including setting the scan attribute to 0), SCAN OFF will be written to the PI Point regardless of the value of the Scan attribute. ========
Thanks.
Private Sub load_ScanOff_Data()
Dim piServerName As String = "****" Dim piSdk As New PISDK.PISDK Dim piServer As PISDK.Server Dim pList As PointList Dim pPoint As PIPoint Dim piVals As PIValues Dim piVal As PIValue
Dim tagName As String Dim strQuery As String strQuery = "Tag ='*'"
piServer = piSdk.Servers(piServerName) piServer.Open() pList = piServer.GetPoints(strQuery)
DGV_CorruptedData.ColumnCount = 3 DGV_CorruptedData.RowCount = 10000 Dim rowNum As Integer = 0 'Dim sType As System.Single For Each pPoint In pList tagName = pPoint.Name piVals = pPoint.Data.RecordedValues("1-jan-2007 5:00PM", "30-jan-2007 10:00PM") rowNum = 0 For Each piVal In piVals 'If piVal.Value.GetType.FullName.Equals(sType) Then ' Make a list of all tags that are 'Scan Off'.... 'End If 'Temporarly using this but not the proper way to do this... If IsNumeric(piVal.Value.ToString.Trim) Then 'Me.DGV_CorruptedData.Rows(rowNum).Cells(0).Value = tagName 'Me.DGV_CorruptedData.Rows(rowNum).Cells(1).Value = piVal.Value.ToString.Trim 'Me.DGV_CorruptedData.Rows(rowNum).Cells(2).Value = piVal.TimeStamp.LocalDate Else Me.DGV_CorruptedData.Rows(rowNum).Cells(0).Value = tagName Me.DGV_CorruptedData.Rows(rowNum).Cells(1).Value = piVal.Value.ToString Me.DGV_CorruptedData.Rows(rowNum).Cells(2).Value = piVal.TimeStamp.LocalDate End If rowNum = rowNum + 1 Next Next piServer.Close()
End Sub
|
|
|
|
|
OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System. We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ or contact OSIsoft vCampus for more details.
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 612 Location: Cheshire, United Kingdom.
|
Hello, When you have a DigitalState returned for a value, you need to assign to a DigitalState object. You can check the value type to see if it is a digitalstate: Code: If piVal.GetType().IsCOMObject Then 'We have a digital value, either from a digital tag or a system digital (error) Dim DS As PISDK.DigitalState = CType(piVal, PISDK.DigitalState) End If
Do you have access to PI-OLEDB? You can form queries much easier to trace specific values with multiple criteria. Rhys. Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
Rank: Newbie Groups: Member
Joined: 5/4/2009 Posts: 2
|
Hi,
It worked...
If piVal.Value.GetType().IsCOMObject Then 'We have a digital value, either from a digital tag or a system digital (error) digSt = CType(piVal.Value, PISDK.DigitalState) Debug.Print(digSt.Name) End If
Yes, I do have access to PI-OLEDB.
Thanks.
|
|
|
Rank: Member Groups: Member
Joined: 3/24/2009 Posts: 20 Location: Saudi Arabia
|
I was about to ask this question....thanks..it worked here also...thanks a lot PI People!!
jayson
|
|
|
|
Guest
|