Hello from Prognoz!

Prognoz Platform and Co.

18.07.16 Tatyana Kochergina
2180 0

High-end software in today’s IT marketplace needs to be IDE-independent and easily integrated into other environments. How well has the Prognoz Platform kept up with the times?

Very well, as it turns out. A variety of custom applications can be built atop the Prognoz Platform, which comes complete with a rich set of components to help you work with data sources and visualize data of any complexity. These components enable you to develop applications of any level in different IDEs. You can easily design in the environment that you’re accustomed to—any environment that supports Windows Forms. You’re free to use the platform’s native environment if you want, but you aren’t confined to it if you don’t.

Now let’s consider a hands-on example that demonstrates the use of Prognoz Platform components in one of the most popular development environments—Microsoft Visual Studio.

We’ll walk through an easy and straightforward procedure of creating a Windows Forms application. This application will enable you to view any type of report or data source, including OLAP reports, as shown in our example below. So let’s create a tree of all the repository’s OLAP reports, where a click on any report will show its content.

The preparatory stage

First, let’s install the x86 desktop application of the Prognoz Platform to access the platform libraries. We’ll choose the full installer, which doesn’t use Reg-Free COM technology. We’ll also install the DevTools utility included in the Prognoz Platform 8 installer package. This utility is specifically designed to enable development in third-party environments. It places Prognoz Platform libraries to the GAC on your local computer, which makes them accessible from any application.

Now let’s start Visual Studio and create a Windows Forms application project.

Similarly to working with any external component library, our components can be added to the Visual Studio toolbox for further use in Designer view of Windows Forms. All the components can be found in one library—Prognoz.Platform.Forms.Net.dll, located in the desktop application’s installation directory.

To add components, we’ll use the Choose Toolbox Items dialog box in the Visual Studio toolbox.

Let’s create a new tab for our components in the toolbox. We call the dialog box and find Prognoz.Platform.Forms.Net.dll.


All the available components will be selected automatically. Click OK to add the selected components to the toolbox.


The setup

The components will be added to a form, and—before the components are used—the class of this form should be inherited from the class specifically designed to ensure the correct operation of these components. This class extends the Windows Forms class and supports the correct operation of the components.

Let’s add the aforementioned Prognoz.Platform.Forms.Net.dll library from the desktop application’s installation directory to References in the Solution Explorer.

We import the Prognoz.Platform.Forms.Net namespace in the using block of the form’s code and replace the base class of the Form with ForeNetFormVS.


To support the operation of components and to use their base properties, other Interop assemblies of the Prognoz Platform should also be added. The Visual Studio will prompt you about which libraries to add while compiling. All these libraries will be located along the installation path of the desktop application.

Let’s add the Prognoz.Fore.dll and Prognoz.Platform.WinForms.Utils.dll assemblies to the project references, as well as other base Interops needed for further work with Prognoz Platform objects.


Before you run the forms, the following methods should be called to ensure the correct display of components. You do this only once, before the first run of a form:

  • Platform.Interop.Ui.IUiWinApplication.CheckAfxStateis a method that initializes the system variables of the platform required for the correct operation of objects.
  • Platform.Forms.Net.ForeNetFormVS.SetActiveMetabase is a method that installs the repository inside which the objects are created.

The necessary assemblies have been already added to the references.

  • Let’s go to the start method of the project—Main in the cs module by default. Before we run the form, let’s write:
using Prognoz.Platform.Interop.Ui;
IUiWinApplication WinAppCls = new UiWinApplicationClass();
       	Application.Run(new Form1());
  • Let’s also write a connection to one of the Prognoz Platform repositories as a separate method and call the above-described SetActiveMetabase method in the start method of the project:
using Prognoz.Platform.Interop.Metabase;
static void Main()
            IMetabase Mb = connect("PROGNOZPLATFORM8_REPO", "user", "psw");
            Application.Run(new StartForm());

static IMetabase connect(string MbName, string user, string password)
            IMetabaseManager manager = (new MetabaseManagerFactoryClass()).Active;
            IMetabaseDefinitions defs = manager.Definitions;
            IMetabaseDefinition MbDef = defs.FindById(MbName);
            ISecurityPackage Package = manager.Packs.FindById(MbDef.SecurityPackage).Package;
            IPasswordCredentials Credentials = (IPasswordCredentials)Package.CreateCredentials(AuthenticationMode.amPassword);
            Credentials.UserName = user;
            Credentials.Password = password;
            IMetabase mb = MbDef.OpenDefault(Credentials);
            return mb;

This connection to the repository should be passed to the class of the form for working with objects there. This can be done in any manner which is convenient for you. We will override the start form constructor by passing the connection to it and calling the constructor method of the ForeNetFormVS base class:

static void Main()
Application.Run(new StartForm());
public StartForm(IMetabase Mb): base(Mb)

The design

Everything is ready to configure the form designer.

Let’s open our StartForm in Designer view. Since our application will display OLAP reports, let’s add components such as MetabaseTreeListNet, UiErAnalyzerNet, and EaxDocumentViewerBoxNet to the form; and then rename and position them in the form as we wish.

Components can be configured to connect to any data source directly in Designer view. Please remember that this only helps to configure the display of components. You still have to write the connection to the repository in the project code as done previously.

To connect to the repository in Designer view, let’s select a form, go to its properties, select the MetabaseDefinition property, and call the connection dialog box. As a result, you get a list of all your computer’s available repositories. These are the same ones that you’ve added to the Prognoz Platform desktop application.



Now we can configure the display and behavior of components in the Designer:

  • For MetabaseTreeListNet:
    1. From the Root property, let’s select the root folder of the repository that we have connected to.
    2. Set the ShowEmptyFolders property to false to hide the folders that do not contain the required sources.
  • For UiErAnalyzerNet, let’s set Active =
  • For EaxDocumentViewerBoxNet, let’s choose UiErAnalyzerNet in the Analyzer

The functionality

We are creating an application to display OLAP reports, so we can filter our object tree by the object type that we need:

  • Go to the Shown event of the form.
  • Write the following to add the filter:
private void StartForm_Shown(object sender, EventArgs e)
           //ObjectsList – name of MetabaseTreeListNet component
            MetabaseDialogClassFilterClass EaxReportsfilter = new MetabaseDialogClassFilterClass();
            EaxReportsfilter.ObjectClass = MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
  • The only thing left to do now is to configure the display of the source. Remember, we’re designing our application to display the content of an OLAP report in the components once this OLAP report is selected from the tree. To implement this process, let’s add the OnSelectionChanged event to the code for the MetabaseTreeListNet component and, in this event, specify the source to be changed in UiErAnalyzerNet once a report is selected in the tree:
private void ObjectsList_OnSelectionChanged(object pSender, Prognoz.Platform.Interop.Forms.TreeControlEventArgs pArgs)
            //erAnalyzer – name of UiErAnalyzerNet component
            this.Cursor = Cursors.WaitCursor;
            IMetabaseObjectDescriptor descriptor;
            descriptor = ObjectsList.SelectedObjects[0];
            erAnalyzer.Object = descriptor;
            this.Cursor = Cursors.Default;

This gives us a full-blown Windows Forms application that enables us to view all the OLAP reports in the Prognoz Platform repository.
Even so, our application is still pretty basic. You could enhance it with visualizations of any report type, such as dashboards, regular reports, time series workbooks, and so on. You could also configure it for selection manipulation, block settings, and so on. Our platform components and all the available functionality of desktop application libraries are designed to help you with this!
Click the link below for a video tutorial about creating Windows Forms applications as we’ve just described.

Prognoz platform integration with VS eng

The bottom line

The Prognoz Platform enables you to develop applications in your preferred environment—with minimum effort and without sacrificing any functionality. And because the platform integrates with external environments, you gain access to all kinds of added functionality for visualizing cubes, reports, dashboards, time series, and models designed in the Prognoz Platform. You can also work with the data from any database. How’s that for high-end software?