YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

[b]Get tag-list with value 'Scan Off' - System.__ComObject[/b] Options · View
TulasiDas
#1 Posted : Monday, May 04, 2009 11:47:16 PM
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
Sponsor  
 
RJK Solutions
#2 Posted : Tuesday, May 05, 2009 10:22:55 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 458
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.



OSIsoft PI System Specialists
PI consultancy on PI Systems, PISDK, AFSDK, OLEDB etc and PI custom developments. Well pretty much anything to do with PI!


TulasiDas
#3 Posted : Tuesday, May 05, 2009 3:35:05 PM
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.
jay10298
#4 Posted : Wednesday, May 13, 2009 8:26:49 AM
Rank: Member
Groups: Member

Joined: 3/24/2009
Posts: 13
Location: Saudi Arabia
I was about to ask this question....thanks..it worked here also...thanks a lot PI People!!

jayson
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.