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

Populating a ProcessBook with Tags Retrieved via Excel Options · View
nickel
#1 Posted : Friday, October 29, 2010 3:20:39 PM
Rank: Newbie
Groups: Member

Joined: 10/29/2010
Posts: 2
Location: Canada
Hi ...

I need to build a ProcessBook from existing tags in our PI Database.

I have already pulled all 311 tags into Excel via the PI/Tag Search in Excel.

I have also pulled in their current values.

How do I get all these tags to appear in a ProcessBook ? I can see how to do it one by one in ProcessBook itself, but is there a bulk way to do it ?

Thanks ...

btw my VBA skills are non-existent !
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.
winslorj
#2 Posted : Tuesday, November 02, 2010 12:19:14 AM
Rank: Newbie
Groups: Member

Joined: 11/1/2010
Posts: 1
Location: Brevard, NC
Nickel,

Unfortunately, short of programmatically creating or modifying a ProcessBook display, you do have to populate the page 1 tag at a time. You could consider creating a page of multiple trends and dropping multiple tags or trend lines on a trend; that is fairly quick to do and visually shows the state of things even when the trends are small.

Rich Winslow
nickel
#3 Posted : Tuesday, November 02, 2010 1:16:20 PM
Rank: Newbie
Groups: Member

Joined: 10/29/2010
Posts: 2
Location: Canada
Thanks Rich,

The only thing that comes close is the drag and drop from the DataFavorites panel in Build Mode.

Thanks again for your message.

Cheers,
Ron
RJK Solutions
#4 Posted : Tuesday, November 02, 2010 5:07:11 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Ron,
(Hi Rich!)

If you wanted to do this on a one-off basis to get the Value symbols created on a display and the re-arrange them, you could do something like the following:

Code:


Sub LoadTagsAsSymbols()

Dim XL As Excel.Application
Set XL = New Excel.Application

Dim WB As Excel.Workbook
Set WB = XL.Workbooks.Open("C:\LoadTags.xlsx")

Dim WS As Worksheet
Set WS = WB.Worksheets("TAGS")

Dim Val As Value
Dim i As Integer, iLeft As Integer, iTop As Integer

iLeft = -15000: iTop = 15000

For i = 1 To 1000
    If WS.Range("A" & i).Value = "" Then Exit For
   
    Set Val = ThisDisplay.Symbols.Add(pbSymbolValue)
        Val.Left = iLeft
        Val.Top = iTop
        Val.SetTagName WS.Range("A" & i).Value
       
        If (iTop - Val.Height - 5) < (ThisDisplay.ViewTop - ThisDisplay.ViewHeight) Then
            iTop = 15000
            iLeft = iLeft + Val.Width + 1
        Else
            iTop = iTop - Val.Height - 5
        End If
    Set Val = Nothing
Next i

Set WS = Nothing

Call WB.Close(False)
Set WB = Nothing

XL.Quit
Set XL = Nothing

End Sub


Obviously you could get clever and multistate the Value symbols, format them etc but let's keep it simple for now.
Smile
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Keegan
#5 Posted : Tuesday, November 30, 2010 9:21:04 PM
Rank: Newbie
Groups: Member

Joined: 11/30/2010
Posts: 4
Location: Melbourne
Hello,

From the sounds I things I am required to do something similar.

In particular I want to make text boxes contianing the tag name and the ip address that have been put into excel and format these in red for bad data. That way we can monitior all our chart recorders, switches, servers, routers etc. from this.

I have tried the code that was provide for Ron however I get a error message "User-defined Type not Defined"

I have added DAO to the reference to try solve this. Without success.

I just copied and pasted the the code into the Display Objects, ThisDisplay object and edited the directories to where my excel file is located.

I am also using excel 2003 if it makes any difference.

Thanks
RJK Solutions
#6 Posted : Tuesday, November 30, 2010 10:28:32 PM
Rank: Administration

Groups: Administration

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

Welcome to the forum.

Just make sure you have a reference to "Microsoft Excel xx Object Library" where xx = the number to match your version of Excel (12 for Excel 2007).

Smile
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Keegan
#7 Posted : Wednesday, December 01, 2010 4:43:50 AM
Rank: Newbie
Groups: Member

Joined: 11/30/2010
Posts: 4
Location: Melbourne
Thanks for that. It fixed the error.

Cheers
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.