Once you have created the dataset and added it to the collection of the datasets for the display, you need to call GetDataset in order to edit the properties:
Set myDataSets = ThisDisplay.Datasets Set myDS = myDataSets.Add("Test", Nothing, True, 1, True, pbDatasetPIExpression) Set myDS = myDataSets.GetDataset("Test") With myDS .ServerName = "SOCC" .Expression = myExp ' .Expression = "'sinusoid'*3" .Description = "Edit at " & Now() .ColumnName = "Value" .RefreshInterval = 3600 .Interval = "10M" End With myDataSets.SetDataset myDS
1 of 1 people found this helpful
I just want to add that in general, we discourage the use of PI Calculation Data Sets in PI ProcessBook, in favor of configuring an analogous AF Analysis, PE Equation or Totalizer point. There are several reasons for this:
- PI ProcessBook Calculation Data Sets need to be re-calculated with every refresh. If using one of the other options above, then the calculations are calculated once, and stored into a point. This should improve performance, especially for potentially expensive calculations. If you have many ProcessBook connections all running the same calculation, it can be a big hit on PI Data Archive's archive subsystem performance, because archive subsystem will need to calculate the result individually for each connection. However, storing the results in a point means archive subsystem only needs to retrieve already-calculated events.
- Storing the values in a point is much more scalable: the results can then be shared amongst different ProcessBook displays, as well as different clients, without needing each individual client to calculate the result independently.
- Storing the values in a point also give you the history of the calculations.
These are good points, and I agree with all of these reasons for favouring tags over PB datasets. One positive reason for using a calculation dataset though is that it is a quick and easy means of prototyping (and seeing the results of) a PE calculation before committing it to a tag.
1 of 1 people found this helpful
HI Gavin, Appreciate your input and analysis, thanks.
The reason I choose to implement as a Dynamically created Pi ProcessBook calculation set was the analysis that the value being calculated was based on the query time frame. The PB display is really prototyping a view that will be more suited to a report processor evaluating the "Availability Percentage" of systems within the PI infrastructure. The Availability Percentage over a time frame where the time period is the report time period and thus variable did not lend it to the previously mentioned calculation engines where the time parameters of the calculation are fixed in configuration. The problem of the PB Expression being queried multiple times is nothing compared to the PE or analytic being run periodically for an answer that nobody is looking for.
I would be looking for another option in the future where the calculation would be more based like a function call passing in the time range as a parameter, Excel Datalink would have been a good choice but I'm driving the report definition from AF and receiving a Element Relative Context change event. I think this will ultimately end up in a Coresight custom symbol.