LoadFrom(Element: Variant);
LoadFrom(Element: object);
Element. Object, from which parameters of attribute values sorting will be loaded.
The LoadFrom method loads parameters of attribute values sorting from XML.
Use IRdsSortAttributes.SaveTo to save parameters of attributes' sorting.
Executing the example requires that the repository contains an MDM repository with the RDS identifier. This repository must contain a table MDM dictionary with the D_EXP_IMP identifier, that includes export schemes. The file system must contain the file C:\SortAtt.xml, that stores options of filter applied to attribute values in export scheme of the dictionary in XML format.
Add links to the Metabase, Rds and Xml system assemblies.
Sub UserProc;
Var
mb: IMetabase;
rdsKey: Integer;
dictObj: IMetabaseObject;
Dict: IRdsDictionary;
sExport: IMetaRdsExportSchema;
dictSort: IRdsSortAttributes;
Doc: IXmlDomDocument;
Begin
mb := MetabaseClass.Active;
// Get key of the MDM repository
rdsKey := mb.GetObjectKeyById("RDS");
// Get table MDM dictionary
dictObj := mb.ItemByIdNamespace("D_EXP_IMP", rdsKey).Edit;
Dict := dictObj As IRdsDictionary;
// Get the first export scheme
sExport := Dict.ExportSchemas.Item(0) As IMetaRdsExportSchema;
// Get sorting parameters
dictSort := sExport.SortAttributes;
// Load sorting parameters from file
Doc := New DOMDocument.Create;
Doc.load("C:\SortAtt.xml");
dictSort.LoadFrom(Doc.documentElement);
// Save the dictionary
dictObj.Save;
End Sub UserProc;
After executing the example attribute sorting parameters in the first export scheme are loaded from the file C:\SortAtt.xml.
Executing the example requires that the repository contains an MDM repository with the RDS identifier. This repository must contain a table MDM dictionary with the D_EXP_IMP identifier, that includes export schemes. The file system must contain the file C:\SortAtt.xml, that stores options of filter applied to attribute values in export scheme of this dictionary in XML format.
Imports Prognoz.Platform.Interop.MsXml2;
Imports Prognoz.Platform.Interop.Rds;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
rdsKey: uinteger;
dictObj: IMetabaseObject;
Dict: IRdsDictionary;
sExport: IMetaRdsExportSchema;
dictSort: IRdsSortAttributes;
Doc: IXmlDomDocument;
Begin
mb := Params.Metabase;
// Get key of the MDM repository
rdsKey := mb.GetObjectKeyById("RDS");
// Get table MDM dictionary
dictObj := mb.ItemByIdNamespace["D_EXP_IMP", rdsKey].Edit();
Dict := dictObj As IRdsDictionary;
// Get the first export scheme
sExport := Dict.ExportSchemas.Item[0] As IMetaRdsExportSchema;
// Get sorting parameters
dictSort := sExport.SortAttributes;
// Load sorting parameters from file
Doc := New DOMDocumentClass.Create();
Doc.load("C:\SortAtt.xml");
dictSort.LoadFrom(Doc.documentElement);
// Save the dictionary
dictObj.Save();
End Sub;
After executing the example attribute sorting parameters in the first export scheme are loaded from the file C:\SortAtt.xml.
See also: