Palisade Knowledge Base

HomeTroubleshootingAll Products: StartupUpdating @RISK 6.x or 7.x Automation Code to Run in @RISK 8.x

2.102. Updating @RISK 6.x or 7.x Automation Code to Run in @RISK 8.x

Applies to: RDK users 6.x-7.x


Moving to version 8, Palisade has reviewed and improved the XDK interface, taking into account new features and the needs of .NET programmers. This resulted in some changes to the Object Model, method names and parameters, and names of enumerated constants. The major changes are described here in reference to VBA code, but not every detail is covered. In some cases when code created for earlier versions does not compile in version 8, one may need to review the new interface to identify a new way of accomplishing the same objective. Usually it will be possible to identify a similarly named method or property that accomplishes the same task; or in some cases changes to code will be forced by a modified list of method parameters in version 8. However, every effort was made to not change the interface unless necessary, and over 90% of the interface is the same as in previous versions.

Updating Library References

If you have @RISK automation code written for @RISK 6.x or 7.x, you'll need to change the references as described before in this guide for that code to work with @RISK 8.x.

Changes to the Object Model

New Interface for Generating the Standard Reports

Version 8 improved the reporting functionality significantly, with new report types, the option of generating reports in the PDF format, and flexibility in specifying which inputs/output to include in the reports. Consequently, the single Risk.GenerateExcelReports method in version 7 was replaced by a number of methods in the Risk.Simulation.Results.Reports object.

New Format of Enumerated Constant Names

There is a new format for names of enumerated constants in version 8, requiring some changes in VBA code wherever an enumerated constant was used. It should be straightforward to identify the new name of a constant, particularly that the names of the enumerations generally have not changed. For example, "RiskAutomaticResultsDisplay.RiskNoAutomaticResults" in versions 6/7 became "RiskAutomaticResultsDisplay.RiskAutomaticResultsDisplay_RiskNoAutomaticResults". In general, the names of enumerations are included as prefixes in the names of the constants.

New Method of Returning Arrays

In version 8 arrays are returned differently to client code. For example, in version 7 to obtain all the values an output had during a simulation, one called the GetSampleData method, with the array of values returned in the first parameter. The return value from the method is the length of the array.

New Method of Passing Arrays to the XDK

In a few instances in the XDK interface an array is passed by the client code to the XDK. For example, Figure 28 shows the PredefinedFitsSetList method in version 7 (used to pass a list of theoretical probability distributions to fit to data). In version 8 (Figure 29) this method has been separated into two methods, PredefinedFitList_SetArray and PredefinedFitList_Clear. The second method should be used to clear the array stored by the XDK; as opposed to passing an empty array. Important: passing empty arrays to the XDK _SetArray methods can result in Excel crashes. This is due to a bug involving the interaction between VBA and .NET when handling arrays, and is beyond Palisade’s control.

Changes to Methods for Graphing Results

The interface of methods for graphing sensitivity results has changed. Those methods had long lists of arguments. Now there is a new RiskSensitivitySettings object. A programmer can create one of those objects, specify some properties like GraphMaxTornadoBars, and pass the object as a parameter to the graphing method:

Also, the GraphSummary method was replaced by two methods, GraphSummaryBoxPlot and GraphSummaryTrend.

Risk.RefreshUI Method Added

This method was added to address the fact that some XDK calls should update the Excel interface, for example by making changes to the items displayed in the @RISK tab in the ribbon. For instance, setting Risk.Simulation.Settings.NumIterations should update the number of iterations shown on the ribbon.

However, refreshing the interface is time consuming, and setting individual properties no longer refreshes the interface, to avoid multiple unnecessary and time-consuming updates. The RefreshUI method should be called to update the ribbon when needed.

Item no Longer the Default Property

The Item property of collection classes is no longer the default property. So, for example a line deleting a definition of a fit, "Risk.Fits("Costs").Delete" in version 7, becomes "Risk.Fits.Item("Costs").Delete in version 8.

Different Initialization Method with the .NET

Interface See the section of this guide that covers the .NET interface.

Last Update: 2020-04-17


This page was: Helpful | Not Helpful