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

Adding PIModuleDB Property with VBA Options · View
Tommy
#1 Posted : Tuesday, July 20, 2010 1:12:44 AM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
With much guidance from http://www.rjksolutionsltd.co.uk/forum/yaf_postst137_Rapid-PI--PIModuleDatabase-to-PIAF-Conversion-Code.aspx I have manged to retrieve values from the Module Database. And with more stumbling around, I am able to add new modules. My question has to do with how to add properties (haven't tried aliases yet) AND set the appropriate data type.
For example, to get a value:
Code:
PISDK.Server("ServerName").PIModuleDB.PIModules("ModuleA").PIProperties("Property1").Value

And to add a module:
Code:
PISDK.Server("ServerName").PIModuleDB.PIModules("ModuleA").Add ("New Module Name")

And to add a property:
Code:
PISDK.Server("ServerName").PIModuleDB.PIModules("ModuleA").PIProperties.Add ("Property1","_____") = "Value for property"

Where I am confused is:
1) What goes in the blank? It doesn't seem to affect the outcome of the function if it's random or nonsensical.
2) How can the "Value for property" be a date? Below are examples of what an input gives and what the "data type" result is.
5 -> short
5.432 -> double
01-Jun-10 00:00:00 AM -> string
01-Jun-10 00:00:00 -> string
01-Jun-10 -> string
5/13/2010 12:00:00 AM -> string
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
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.
Tommy
#2 Posted : Tuesday, July 20, 2010 8:00:44 PM
Rank: Member
Groups: Member

Joined: 7/19/2010
Posts: 20
I found a solution to the problem. I still don't know what the second value in the parenthesis is for though. To get the module property to be a "date" type:
Code:
Dim DateValue as Date
DateValue = "01-Mar-2010"
PISDK.Server("ServerName").PIModuleDB.PIModules("ModuleA").PIProperties.Add ("Property1","_____") = DateValue
Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
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.