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

PI Trend Title,Scale in Excel Options · View
kapilrakh
#1 Posted : Thursday, September 03, 2009 5:50:23 PM
Rank: Advanced Member

Groups: Member

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

I am trying to add the trend title and set the precision for vertical scale. I am not sure exactly which class to use and how to use it. The way I added the trend has the following code


Quote:

Dim ooOleObjs As OLEObjects
Set ooOleObjs = ActiveSheet.OLEObjects
Dim etWizard As ExcelTrendWizard
Dim strStartTime As Variant
Dim strEndTime As Variant

strStartTime = Cells(7, 4)
strEndTime = Cells(9, 4)

Set etWizard = ooOleObjs.Add("PIXLTWIZ.ExcelTrendWizard").Object

etWizard.PIAddQuerySpec "MyPIServerName", "SINUSOID"
etWizard.PISetTimeRange False, strStartTime, strEndTime
etWizard.InsertTrend Worksheets("Sheet1"), "Sheet1!$A$12:$K$33"





Can you please improve this code with the requirements given above.
Thanks.
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 : Friday, September 04, 2009 5:38:23 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Hi kapilrakh,

Welcome to the forum.

You need to get hold of your Trend object and manipulate the TrendConfig (TrendFormat in ProcessBook, why OSI use different names???) after you have added it to your worksheet. Below is an example if you are using a SingleScale otherwise you need to set a scale for each VerticalScale.

Code:

            Call ooOleObjs("RJK_Solutions_Trend_1").Activate
           
            Dim TheTrend As PITrend
            Set TheTrend = ooOleObjs("PITrend1_Sheet1").Object
           
            Dim TF As TrendConfig
            Set TF = TheTrend.GetConfiguration ' <--- Get the format object
           
            TF.VerticalAxis.VerticalScales.SingleScale.Min = pbwScaleAbsolute ' If absolute, set the AbsoluteMin value
            TF.VerticalAxis.VerticalScales.SingleScale.AbsoluteMin = -2
           
            TF.VerticalAxis.VerticalScales.SingleScale.Max = pbwScaleAbsolute
            TF.VerticalAxis.VerticalScales.SingleScale.AbsoluteMax = 10
           
            TF.Title = "RJK Solutions - OSISoft PI System Specialists." ' <--- Your friendly neighbourhood PI specialists
           
            Call TheTrend.SetConfiguration(TF) ' ---> Set the format object
            Set TF = Nothing


Enjoy!

Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
kapilrakh
#3 Posted : Friday, September 04, 2009 5:57:21 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Thanks RJK. I had hard time in setting the configuration even though I used the TrendConfig object.Brick wall

Using TrendConfig object , the way you did, will certainly help to get me trends which will look nice after printing. Dancing

The PI Trend Control Programmer's reference is concise. ( especially for me who is new to VBA )

I am very happy to get a quick reply. Thanks again RJK.

Kapil.


RJK Solutions
#4 Posted : Friday, September 04, 2009 6:00:02 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
No problem, that's what the forums are here for so don't hesitate to post for another quick answer to your PI issues!
Principal Consultant
Real-Time Data Management @ Wipro Technologies
ThePIman
#5 Posted : Monday, September 07, 2009 7:43:29 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2009
Posts: 35
Location: UK
kapilrakh wrote:
The PI Trend Control Programmer's reference is concise. ( especially for me who is new to VBA )


Is that a book, because I can't find it on the OSI site ?

.
kapilrakh
#6 Posted : Wednesday, September 23, 2009 5:38:33 PM
Rank: Advanced Member

Groups: Member

Joined: 9/3/2009
Posts: 36
Location: Massachusetts, USA
Quote:
Is that a book, because I can't find it on the OSI site ?


Its a help file you can get in /Program Files/PIPC/Help/PITRENDAUTO
TulsaTime
#7 Posted : Wednesday, November 11, 2009 10:31:48 PM
Rank: Newbie
Groups: Member

Joined: 11/11/2009
Posts: 1
Location: Tulsa, OK
I have a sheet with a trend displayed (W1_PITrend1), but I'm having trouble activating the object in order to use the methods above to alter the trend.

I think it might have something to do with me not understanding the ooOleObjs comand listed below which was referenced above.

Call ooOleObjs("RJK_Solutions_Trend_1").Activate
Set TheTrend = ooOleObjs("PITrend1_Sheet1").Object

Can anyone help?
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.