tambijagdish

Is there any way to programatically create and plot - PI calculation data set into PB trend?

Discussion created by tambijagdish on Dec 21, 2011
Latest reply on Sep 3, 2015 by DTE_Employee

Hi,

 

I am trying to plot a PI calculation data set into ProcessBook trend programatically, but it is not plotting the expression result. Below is the snippet of the code,

 

Dim MyDatasets As Datasets                                                      ‘Declaring a datasets object

 

Dim MyDataset As PIExpressionDataset                                ‘PI calculation dataset object

 

Dim MyColumn As String                                                              ‘String object to hold the column value

 

Dim MyPlaceHolders As Placeholders                                    

 

Dim MyPlaceHolder As Placeholder

 

Dim MyDataPoints As DataPoints

 

Dim MyDataPoint As DataPoint

 

 

 

 

 

Set MyDatasets = ThisDisplay.Datasets                                  ‘setting the dataset of the current display to the declared dataset object

 

Set MyDataset = MyDatasets.Add("NewCalcDataSet", Nothing, True, 1, True, pbDatasetPIExpression)                  ‘definition of the dataset

 

Set MyDataset = MyDatasets.GetDataset("NewCalcDataSet")                                   ‘Getting the reference of newly created dataset

 

 

 

 

 

MyDataset.ServerName = "OMSWT05"                 ‘Assigning the server name OMSWT05 is the server name in this case

 

MyDataset.Expression = "'sinusoid'*2"                  ‘Defining the expression

 

MyDataset.RefreshInterval = 3600

 

MyDataset.ColumnName = "Value"                        setting the column to the value type

 

MyDataset.Interval = "10m"

 

 

 

MyDatasets.SetDataset MyDataset                         ‘Setting newly created data set to the datasets object

 

 

 

MyColumn = MyDataset.ColumnName                 ‘Assigning column of dataset to Mycolumn object

 

 

 

Set MyPlaceHolders = MyDataset.Placeholders

 

 

 

Set MyPlaceHolder = MyPlaceHolders.Item(1)  

 

MyPlaceholder.SetValue("Value1", pbcPlaceholderText)

 

 

 

Trend1.AddTrace (MyColumn)                                  ‘Adding the dataset column as trace

 

Trend1.CurrentTrace = "MyTrace"

 

 

 

Set MyDataPoint = Trend1.DataPoint

 

Set MyPlaceHolders = MyDataPoint.Placeholders

 

Set MyPlaceHolder = MyPlaceHolders.Item(1)

 

MyPlaceHolder.Value = "NewValue"

 

 

Outcomes