CreateUnits;
The CreateUnits method creates a units dictionary in the MDM repository. This method is used when a time series database is being created, if no basic dictionaries are created in the MDM repository.
Executing the example requires that the repository contains a database with the BD identifier.
Sub Main;
Var
Mb: IMetabase;
NewRDS: IRdsDatabase;
NewRub: IRubricator;
CrInfo: IMetabaseObjectCreateInfo;
Begin
Mb := MetabaseClass.Active;
//Create MDM repository
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_RDS_DATABASE;
CrInfo.Id := "NewNSI";
CrInfo.Name := "NewNSI";
CrInfo.Parent := MB.Root;
CrInfo.Permanent := True;
NewRDS := MB.CreateObject(CrInfo).Edit As IRdsDatabase;
NewRDS.Database := Mb.ItemById("BD").Bind As IDatabase;
(NewRDS As IMetabaseObject).Save;
//Create a time series database
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_RUBRICATOR;
CrInfo.Id := "NewCatalog";
CrInfo.Name := "NewCatalog";
CrInfo.Parent := MB.Root;
CrInfo.Permanent := True;
NewRub := MB.CreateObject(CrInfo).Edit As IRubricator;
NewRub.Database := NewRDS;
//Create basic dictionaries in the MDM repository
NewRub.CreateMeasures;
NewRub.CreateUnits;
NewRub.CreateFacts;
NewRub.CreateRevisions;
NewRub.CreateValues;
(NewRub As IMetabaseObject).Save;
End Sub Main;
After executing the example a time series database and MDM repository are created in the repository root. All basic dictionaries required for working with the time series database are created in the MDM repository.
See also: