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

Get all tag value for the period Options · View
nexys
#1 Posted : Friday, January 13, 2012 12:33:11 PM
Rank: Newbie
Groups: Member

Joined: 1/10/2012
Posts: 2
Location: Russia
Hello!
I have 2 trend on my display. How can i get all tag values from first and second trends, and put it into table (p.e. listview).
I need a VBA solution for my task.

And sorry for my bad english.
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.
squatty
#2 Posted : Friday, January 13, 2012 1:13:01 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
You do realize that if you right-click on the trend in run time and you select "Details and Annotation" the data will be displayed in tabled format which you can then export if needed, or do you want to achieve something else.
squatty
#3 Posted : Friday, January 13, 2012 1:19:26 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
Sorry for the double post, but is there only one or multiple plots per trend? Do you require archive or sampled data (evenly spaced data), there is a lot you will need to think about before starting to write the code, must the table update as the user changes time range is but one of them I can think of.
nexys
#4 Posted : Friday, January 13, 2012 4:24:37 PM
Rank: Newbie
Groups: Member

Joined: 1/10/2012
Posts: 2
Location: Russia
Thanks for reply, Squatty!

The method you describe is not good for me, becaurse i need then for button click work with array of data from plots. I need a VBA solution to extrackt data from plot, but i dont know how do that.
There only one plots per trend. I requared data from some time period, p.e. 18-01-2011 - 01.01.2012.
squatty
#5 Posted : Sunday, January 15, 2012 7:11:38 PM
Rank: Advanced Member

Groups: Member

Joined: 4/7/2011
Posts: 137
Location: KZN, South Africa
nexys

I would strongly advise you to read the PI-SDK help file as well as the ProcessBook VBA help, I was in the same position where you are now 6 month ago, not knowing where to start, but both these files have a comprehensive help as well as examples for VBA as well as SDK.

Do you require a listview for each trend, or do you want to "combine" data from all plots into one listview?
Will you be viewing process or manual data?
Showing data in a listview is one thing, but what is your intention with the data once it is in the list?

I can't be of much help unless I have more detail and also keep in mind that I'm doing this during working hours. Also note that it is Sunday, I have sunburn, 2nd cup of coffee and half asleep....zzzzzzz.
milesUK
#6 Posted : Monday, January 16, 2012 8:45:12 AM
Rank: Advanced Member
Groups: Member

Joined: 5/28/2009
Posts: 75
Location: Cheshire, UK
nexys, do you have Excel & the PI DataLink AddIn? Those two combined will provide what you need I'm sure.
MilesUK
ProcessBook v3.0.15.3
mjcordeiro
#7 Posted : Wednesday, May 02, 2012 11:23:39 AM
Rank: Member
Groups: Member

Joined: 1/24/2012
Posts: 10
Location: mjcordeiro
Hello,

I thing this will help you. I done it using VBA in EXCEL.

Quote:

Dim svr As PISDK.Server
Dim pt As PISDK.PIPoint
Dim vals1 As PISDK.PIValues
Dim v As PISDK.PIvalue
Dim st1, en1 As Date
Dim itvl, variavel, i As Integer

itvl = 5 'Interval (in seconds)


Set svr = PISDK.Servers(YOURSERVER)
svr.Open

Variavel = "YOUR_PI_VARIABLE"

Set pt = svr.PIPoints(Variavel)

st1 = "yyyy-mm-dd hh:mm:ss"
en1 = "yyyy-mm-dd hh:mm:ss"

Set vals1 = pt.Data.InterpolatedValues(st1, en1, DateDiff("s", st1, en1) / itvl)


For Each v In vals1

Each_Value_Is_Here = v.Value

Next v
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.