|
|
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.
|
|
|
|
|
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.
|
|
|
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
|
|
|
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. Using TrendConfig object , the way you did, will certainly help to get me trends which will look nice after printing. 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.
|
|
|
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
|
|
|
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 ? .
|
|
|
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
|
|
|
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?
|
|
|
|
Guest
|