Create ADOMD Catalog

An ADOMD catalog is an object of the MetabaseObjectClass.KE_CLASS_ADOMD_CATALOG class. To create a new catalog, initialize an object containing description of the object to be created, set a given object class and other required description:

Var
    //...
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    //...
Begin
    //...
    MB := MetabaseClass.Active;
    //Information to create a new ADOMD catalog
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_ADOMD_CATALOG;
    CrInfo.Id := "MAS_TEST";
    CrInfo.Name := "Catalog based on MSSQL Analysis Services";
    CrInfo.Parent := MB.ItemById("F_ADOMD");

On executing the CreateObject method, a new catalog is created, that can be immediately opened to edit, cast to the IAdoMdCatalog interface and set up required connection parameters.

Var
    //...
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    Catalog: IAdoMdCatalog;
    //...
Begin
    //...
    //Create ADOMD catalog
    Catalog := MB.CreateObject(CrInfo).Edit As IAdoMdCatalog;
    //Set up parameters
    Catalog.Driver := "MSOLAP";
    Catalog.Server := "MAS_TEST";
    Catalog.Name := "TEST_CUBE";
    Catalog.Authentication := AuthenticationMode.Password;
    Catalog.UseMetabaseCredentials := False;
    Creds := Catalog.Credentials As IPasswordCredentials;
    Creds.UserName := "User1";
    Creds.Password := "password";
    Catalog.Credentials := Creds;
    //Save ADOMD catalog
    (Catalog As IMetabaseObject).Save;

After saving the created object the ADOMD catalog is available in the repository. At the moment, the catalog is empty, as it is not synchronized with the server, to which it is set up. In order objects appear in the ADOMD catalog, you need to open it and call the Refresh method:

Var
    //...
    MB: IMetabase;
    CatalogInst: IAdoMdCatalogInstance;
    //...
Begin
    //...
    MB := MetabaseClass.Active;
    Catalog := MB.ItemById("MAS_TEST").Open As IAdoMdCatalogInstance;
    CatalogInst.Refresh;

On executing the Refresh method, ADOMD cubes and dictionaries are created in the ADOMD catalog, which represent multidimensional sources stored in the server.

The ADOMD cubes, as all the other platform cubes, support the ICubeModel interface and ADOMD dictionaries, as well as the dictionaries, support the IDimensionModel interface.

See also:

About the AdoMd Assembly