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

Setting standard fields in Legends Options · View
kapilrakh
#1 Posted : Friday, December 18, 2009 3:50:36 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Hi again,

I am having a PI Trend in my excel sheet. I am plotting data on it coming from PI.
I am able to format the trend using TrendConfig object.
In the legends field I want to keep very specific information.
The enum parameters available in PI for legends are.

Code:

pbwStandardFieldMarker    
pbwStandardFieldName    
pbwStandardFieldDescription    
pbwStandardFieldLastValue    
pbwStandardFieldEngUnits    
pbwStandardFieldComment    

I have also seen similar enums like pbwLegendsConfigStandardFieldMarker and etc.

I just want to use the 2'nd and the 5'th enum in the above list. This should be a bitwise operation.

The trendobject on the excel sheet is "PITrend1".
How do I change my legend information?

You'll have to use LegendConfig or LegendsConfig object. I am not sure.

Please reply.

Thanks

Kapil.
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.
Michael
#2 Posted : Friday, December 18, 2009 7:09:27 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
Kapil,

try

Dim tr As PITrend
Dim cfg As PBWebClient.TrendConfig
Set tr = ActiveSheet.PITrend1_Tabelle1 'put your object here
Set cfg = tr.GetConfiguration
Debug.Print cfg.Legends(1).StandardFields
cfg.Legends(1).StandardFields = 1 + 2 + 4 + 8 + 16 + 32 'select the elements you want to see [pbwLegendStandardFieldBits]
tr.SetConfiguration cfg



Hope this helps

Michael
kapilrakh
#3 Posted : Friday, December 18, 2009 8:14:56 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Thanks Mike.

The only thing I did wrong was I used AND operator instead of regular + sign . ( And I used full name too like pbwLegendStandardFieldMarker instead of its value 1 etc)

The next one is little challenging. I have already posted it in this forum. However this is the link to the thread.

Michael
#4 Posted : Friday, December 18, 2009 8:28:16 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
you're welcome Kapil

of course you should use the element names instead of their values, but it was faster to type :-)

Btw:
I found it often easier to pre-configure a trend and I modify the datasources only using VBA, instead of manipulating the format definitions, even in ProcBook. I raised some support calls regarding strange behaviour of the trend object.

Michael


kapilrakh
#5 Posted : Friday, December 18, 2009 8:40:34 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Thats true Michael. In my case I have to insert a new trend everytime the user hits the command button and delete the previous one. Hence the necessity to format it.
I haven't had much chance to work with vba of trend in Procbook but both are essentially the same.
Michael
#6 Posted : Friday, December 18, 2009 8:53:49 PM
Rank: Advanced Member
Groups: Member

Joined: 12/3/2009
Posts: 71
Location: Germany/Pennsylvania
well, I had exactly the same problem.

The simple solution was to configure the perfect formatted trend (including all the placeholders for traces), shrink it OR make it invisible, put it somewhere.

Configure it, bring it to full size OR visible if requested.

Michael
kapilrakh
#7 Posted : Friday, December 18, 2009 9:05:18 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Quote:
The simple solution was to configure the perfect formatted trend (including all the placeholders for traces), shrink it OR make it invisible, put it somewhere.

Configure it, bring it to full size OR visible if requested.



This is very good solution. I don't know why I didnt come up with that. My current report takes a while to generate becasue of deleting and inserting trend.
Making it invisible makes sense. Simple and better.
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.