AllDictionary(Source: IRdsDictionary): IRdsDictionaryConverterList;
AllDictionary(Source: Prognoz.Platform.Interop.Rds.IRdsDictionary): Prognoz.Platform.Interop.Rds.IRdsDictionaryConverterList;
Source. MDM dictionary to be converted.
The AllDictionary property returns the list of MDM dictionaries converted to table MDM dictionaries.
To convert all MDM dictionaries to table MDM dictionaries, use the IRdsDictionaryConverter.ConvertAll method.
Executing the example requires an MDM repository with the MDM identifier that contains a dictionary with the RDS identifier.
Add links to the Metabase, Rds system assemblies.
Sub UserProc;
Var
MB: IMetabase;
RdsKey: Integer;
MObj: IMetabaseObject;
RDS: IRdsDictionary;
Converter: IRdsDictionaryConverter;
List: IRdsDictionaryConverterList;
NotConv: IMetabaseObjectDescriptors;
pReasons: IRdsNotConvertibleReasons;
pReason: IRdsNotConvertibleReason;
i, j: Integer;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get MDM dictionary
RdsKey := MB.GetObjectKeyById("MDM");
MObj := MB.ItemByIdNamespace("RDS", RdsKey).Bind;
RDS := MObj As IRdsDictionary;
// Convert dictionary and display errors, if it cannot be converted
Converter := New RdsDictionaryConverter.Create;
List := Converter.AllDictionary(RDS);
NotConv := List.NotConvertibleDictionaries;
For i := 0 To NotConv.Count - 1 Do
pReasons := List.GetNotConvertibleReasons(NotConv.Item(i).Key);
Debug.WriteLine("Total errors: " + pReasons.Count.ToString);
For j := 0 To pReasons.GetExplanation.Length - 1 Do
pReason := pReasons.Item(j);
Debug.WriteLine("Error code: " + pReason.Reason.ToString);
Debug.Indent;
Debug.WriteLine("Reason: " + pReason.GetExplanation);
End For;
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RdsKey: uinteger;
MObj: IMetabaseObject;
RDS: IRdsDictionary;
Converter: IRdsDictionaryConverter;
List: IRdsDictionaryConverterList;
NotConv: IMetabaseObjectDescriptors;
pReasons: IRdsNotConvertibleReasons;
pReason: IRdsNotConvertibleReason;
i, j: Integer;
Begin
// Get repository
MB := Params.Metabase;
// Get MDM dictionary
RdsKey := MB.GetObjectKeyById("MDM");
MObj := MB.ItemByIdNamespace["RDS", RdsKey].Bind();
RDS := MObj As IRdsDictionary;
// Convert dictionary and display errors, if it cannot be converted
Converter := New RdsDictionaryConverter.Create();
List := Converter.AllDictionary[RDS];
NotConv := List.NotConvertibleDictionaries;
For i := 0 To NotConv.Count - 1 Do
pReasons := List.GetNotConvertibleReasons(NotConv.Item[i].Key);
System.Diagnostics.Debug.WriteLine("Total errors: " + pReasons.Count.ToString());
For j := 0 To pReasons.GetExplanation().Length - 1 Do
pReason := pReasons.Item[j];
System.Diagnostics.Debug.WriteLine("Error code: " + pReason.Reason.ToString());
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Reason: " + pReason.GetExplanation());
End For;
End For;
End Sub;
After executing the example the console window displays: number of errors, error code and reasons, due to which MDM dictionary cannot be converted to table MDM dictionary.
See also: