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

problem with GetPoints in vba - returning name resolver error Options · View
Jason
#1 Posted : Friday, March 11, 2011 8:13:45 PM
Rank: Newbie
Groups: Member

Joined: 3/11/2011
Posts: 3
I'm trying to write a piece of code that will retrieve a pi tag, so I can post the value to either an excel sheet or a VB form. I'm new to coding with the PISDK. When I run this piece of code I get a runtime error saying it's a name resolver issue. The error occurs on the last line. Does anyone see why this is not working? thanks, jason

HEre is my code:

Dim myServer As String
myServer = "pisrv1"

'Declare Server and PointList
Dim PiSvr As PISDK.Server
Dim testtag As PISDK.PointList

Dim WhereClause As String

Set PiSvr = Servers.DefaultServer
PiSvr.Open (myServer)

WhereClause = "tag = jasontest2.pv"

Set testtag = PiSvr.GetPoints("tag = jasontest2.pv")
Sponsor  
 

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.
RJK Solutions
#2 Posted : Monday, March 14, 2011 9:49:31 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Jason,

Welcome to the forum.

You need to enclose a single quote around your tag name.

So

Code:

Set testtag = PiSvr.GetPoints("tag = jasontest2.pv")


becomes

Code:

Set testtag = PiSvr.GetPoints("tag ='jasontest2.pv'")


Principal Consultant
Real-Time Data Management @ Wipro Technologies
Jason
#3 Posted : Monday, March 14, 2011 12:51:29 PM
Rank: Newbie
Groups: Member

Joined: 3/11/2011
Posts: 3
Thanks, I've now got it working in Excel's VBA, but am also trying to get it working in VB from visual studio. However I keep getting a NotImplementedException() thrown. here is my code. Hate to ask again, but do you see anything in my code that may be throwing this exception. I haven't used Visual Studio in years, so I'm not truly sure if it's the code or the environment not set up.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Declare Server and PointList
Dim PiSvr As PISDK.Server
Dim testtag As PISDK.PointList
Dim WhereClause As String
Dim myServer = "789PiSrv1"


'define what PiSvr connects too

PiSvr = Servers(myServer)
PiSvr.Open()


'Set what tag to look for
WhereClause = "tag = 'jasontest2.pv'"
testtag = PiSvr.GetPointsSQL(WhereClause)
MsgBox(testtag(1))
MsgBox(testtag(1).Data.Snapshot)


' close connection to database
PiSvr.Close()

testtag = Nothing
PiSvr = Nothing

End Sub

Private Function Servers(ByVal p1 As String) As Server
Throw New NotImplementedException
End Function
RJK Solutions
#4 Posted : Monday, March 14, 2011 4:30:30 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
What version of PISDK are you using?
Not Implemented exceptions are for occasions when the method signatures of future functionality are included in PISDK. GetPointsSQL should be implemented unless you have an old version..?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Jason
#5 Posted : Monday, March 14, 2011 4:33:23 PM
Rank: Newbie
Groups: Member

Joined: 3/11/2011
Posts: 3
Running version 1.3.8.388
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.