Examples of creating a table MDM dictionary are given in the Fore and Fore.NET languages.
Executing the example requires an MDM repository with the RDS_REPO identifier and a database with the DB identifier.
After executing examples a table MDM dictionary is created in the RDS_REPO repository. Information on this dictionary is displayed in the console window.
Add links to the Metabase, Rds, and Db system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Inf: IMetabaseObjectCreateInfo;
Des: 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_REPO");
Inf.KeepEdit := True;
Des := Mb.CreateObject(Inf);
RdsDict := Des As IRdsDictionary;
RdsDict.Database := Mb.ItemById("DB").Bind As IDatabase;
If RdsDict.Type = RdsDictionaryType.MetaDictionaryRds Then
Debug.WriteLine("Table MDM dictionary is created:");
Debug.Indent;
Debug.WriteLine("- name: «" + Des.Name + "»");
Debug.WriteLine("- identifier: «" + Des.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;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Db;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Inf: IMetabaseObjectCreateInfo;
Des: IMetabaseObjectDescriptor;
RdsDict: IRdsDictionary;
Begin
Mb := Params.Metabase;
Inf := Mb.CreateCreateInfo();
Inf.ClassId := MetabaseObjectClass.KE_CLASS_METADICTIONARYRDS As integer;
Inf.Name := Inf.DefaultName;
Inf.Parent := Mb.ItemById["RDS_REPO"];
Inf.KeepEdit := True;
Des := Mb.CreateObject(Inf);
RdsDict := Des As IRdsDictionary;
RdsDict.Database := Mb.ItemById["DB"].Bind() As IDatabase;
If RdsDict.Type = RdsDictionaryType.rdtMetaDictionaryRds Then
System.Diagnostics.Debug.WriteLine("Table MDM dictionary is created:");
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("- name: «" + Des.Name + "»");
System.Diagnostics.Debug.WriteLine("- identifier: «" + Des.Id + "»");
System.Diagnostics.Debug.WriteLine("- physical name of the table used to store data: «"
+ RdsDict.TableName + "»");
System.Diagnostics.Debug.Unindent();
(RdsDict As IMetabaseObject).Save();
End If;
End Sub;
See also: