Show contents 

Rds > Rds Assembly Interfaces > IMetaDictionary > IMetaDictionary.Indexes

IMetaDictionary.Indexes

Syntax

Indexes: IMetaIndexes;

Description

The Indexes property returns a collection of indexes of time series database.

Example

Executing the example requires an MDM repository with the RDS_REPO identifier. The MDM repository must contain dictionaries with the DICT_CTR and DICT_IND identifiers.

Add links to the Cubes, Metabase, Rds system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    Inf: IMetabaseObjectCreateInfo;
    Obj: IMetabaseObjectDescriptor;
    Cat: IRubricator;
    RdsDescr: IMetabaseObjectDescriptor;
    Rds: IRdsDatabase;
    Facts: IMetaDictionary;
    Attributes: IMetaAttributes;
    Attribute: IMetaAttribute;
    Indexes: IMetaIndexes;
    Index: IMetaIndex;
    AttrColl: IMetaAttributesCollection;
Begin
    Mb := MetabaseClass.Active;
    RdsDescr := Mb.ItemById("RDS_REPO");
    // Determine time series database parameters
    Inf := Mb.CreateCreateInfo;
    Inf.Id := Mb.GenerateId("OBJ_FC");
    Inf.Name := Inf.Id;
    Inf.ClassId := MetabaseObjectClass.KE_CLASS_RUBRICATOR;
    Inf.Parent := Mb.Root;
    Inf.KeepEdit := True;
    Obj := Mb.CreateObject(Inf);
    Cat := (Obj As IRubricator);
    Rds := RdsDescr.Bind As IRdsDatabase;
    Cat.Database := Rds;
    Cat.GetDictionary(RubricatorDictionary.AllDictionaries,
    RubricatorDictionaryOperation.Create Or RubricatorDictionaryOperation.ForEachBasis);
    // Create a mandatory custom attribute COUNTRY
    Facts := Cat.Facts;
    Attributes := Facts.Attributes;
    Attribute := Attributes.Add;
    Attribute.Id := "COUNTRY";
    Attribute.Name := "Country";
    Attribute.Nullable := False;
    Attribute.HasMultipleValues := False;
    Attribute.DataType := DbDataType.Integer;
    Attribute.ValuesObject := Mb.ItemByIdNamespace("DICT_CTR", RdsDescr.Key).Bind;
    // Create a mandatory custom attribute INDICATOR
    Attribute := Attributes.Add;
    Attribute.Id := "INDICATOR";
    Attribute.Name := "Indicator";
    Attribute.Nullable := False;
    Attribute.HasMultipleValues := False;
    Attribute.DataType := DbDataType.Integer;
    Attribute.ValuesObject := Mb.ItemByIdNamespace("DICT_IND", RdsDescr.Key).Bind;
    // Create index
    Indexes := Facts.Indexes;
    Index := Indexes.Add;
    Index.Name := New index;
    Index.Unique := True;
    Attributes := Facts.Attributes;
    AttrColl := Index.Attributes;
    Attribute := Attributes.FindById("COUNTRY");
    AttrColl.Add(Attribute);
    Attribute := Attributes.FindById("INDICATOR");
    AttrColl.Add(Attribute);
    Attributes.CreateTable;
    (Obj As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the OBJ_FC time series database is created in the repository. A unique index that consists of the mandatory custom attributes COUNTRY and INDICATOR is created to measure indicators.

See also:

IMetaDictionary