Zero axis on ProcBook trend

Discussion created by cjrancur on Mar 17, 2011
Latest reply on Mar 18, 2011 by Ahmad Fattahi

I wanted to highlight the horizontal axis at value = 0 in red, for a ProcBook trend that includes data scaled equally in the positive and negative directions, like +5 to -5, for example.


I thought I could use a dataset to build the equivalent of a PI tag that was always at zero, and then trend that dataset value with a red pen. 


 So I tried manually building a dataset, with the expression of sin(0), and it worked.  I have several ProcBooks that I'd like to configure this way, so I tried to automate the dataset creation in vba. 


Now I'm stumped on an enumerator type.  I can't find the reference that includes "pbcDatasetExpression", and so my test won't compile.  Here's the code.  It is from the Process Book VBA Reference help file, except the expression uses sin(0) instead of sinusoid.

Private Function makeDataSetForZeroAxis() As Dataset

Dim Application As Object
Dim MyDatasets As New Datasets
Dim myDataSet As Dataset
    Set MyDatasets = Application.Datasets
    Set myDataSet = MyDatasets.Add("ZERO DEVIATION", Null, True, 1, True, pbcdatasetexpression)
    myDataSet.Expression = "'SIN(0)'"
    myDataSet.RefreshInterval = 3600
End Function

 The help file also mentions a whitepaper on the support site, called "Creating a custom dataset", but I searched and could not find it.


 The above function fails to compile when it reaches the symbol, "pbcDatasetExpression", in the MyDatasets.Add method. I've tried adding the SDK common and SDK 1.3, plus pipc32 libraries, but I haven't found the right type for the "pbcDatasetExpression".  Then, I tried substituting pbcDatasetExpression with the number 0, and all I found was that vba does not know what "Application.Datasets" are, so I know I have other problems besides lacking the enumerator. 


 Maybe there's a better way to make the zero axis bold and red in ProcBook. Suggestions on doing this more simply are requested.


If the dataset idea is the only way to do this, then please help me to find the necessary type libraries for the pbcdatasetexpression, and also please help with defining MyDatasets, because the above function gets a value of "nothing" for MyDatasets.