Creating an MDM Dictionary

Below is the example of creating an MDM dictionary using the Fore language.

Executing the example requires a folder with RDS_FOLDER identifier and a database with the DB identifier.

Example

Add links to the Metabase, Rds, and Db system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    Inf: IMetabaseObjectCreateInfo;
    Desc: IMetabaseObjectDescriptor;
    RdsDict: IRdsDictionary;
Begin
    Mb := MetabaseClass.Active;
    Inf := Mb.CreateCreateInfo;
    Inf.ClassId := MetabaseObjectClass.KE_CLASS_METADICTIONARYRDS;
    Inf.Name := Inf.DefaultName;
    Inf.Parent := Mb.ItemById("RDS_FOLDER");
    Inf.KeepEdit := True;
    Desc := Mb.CreateObject(Inf);
    RdsDict := Desc As IRdsDictionary;
    RdsDict.Database := Mb.ItemById("DB").Bind As IDatabase;
    If RdsDict.Type = RdsDictionaryType.MetaDictionaryRds Then
        Debug.WriteLine("MDM dictionary is created:");
        Debug.Indent;
        Debug.WriteLine("- name: «" + Desc.Name + "»");
        Debug.WriteLine("- identifier: «" + Desc.Id + "»");
        Debug.WriteLine("- physical name of the table used to store data: «" + RdsDict.TableName + "»");
        Debug.Unindent;
        (RdsDict As IMetabaseObject).Save;
    End If;
End Sub UserProc;

After executing the example a new MDM dictionary is created in the specified folder. Basic information about the dictionary will be displayed in the development environment console.

See also:

Examples | IRdsDictionary