SaveTo(Element: Variant);
SaveTo(Element: object);
Element. Object, to which sorting parameters will be saved as XML code.
The SaveTo method saves parameters of attributes values' sorting as XML code.
Use the IRdsSortAttributes.LoadFrom method to load sorting parameters from XML.
Executing the example requires that the repository contains an MDM repository with the RDS identifier. The repository must contain a table MDM dictionary with the D_EXP_IMP identifier that includes export schemes.
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;
Element: IXmlDomElement;
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).Bind;
Dict := dictObj As IRdsDictionary;
// Get the first export scheme
sExport := Dict.ExportSchemas.Item(0) As IMetaRdsExportSchema;
// Get sorting parameters
dictSort := sExport.SortAttributes;
// Save parameters to file
Doc := New DOMDocument.Create;
Element := Doc.createElement("SortAtt");
dictSort.SaveTo(Element);
Doc.appendChild(Element);
Doc.save("C:\SortAtt.xml");
End Sub UserProc;
After executing the example attribute sorting parameters in the first export scheme are saved to the file C:\SortAtt.xml.
Executing the example requires that the repository contains an MDM repository with the RDS identifier. The repository must contain a table MDM dictionary with the D_EXP_IMP identifier that includes export schemes.
Imports Prognoz.Platform.Interop.MsXml2;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
rdsKey: uinteger;
dictObj: IMetabaseObject;
Dict: IRdsDictionary;
sExport: IMetaRdsExportSchema;
dictSort: IRdsSortAttributes;
Doc: IXmlDomDocument;
Element: IXmlDomElement;
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].Bind();
Dict := dictObj As IRdsDictionary;
// Get the first export scheme
sExport := Dict.ExportSchemas.Item[0] As IMetaRdsExportSchema;
// Get sorting parameters
dictSort := sExport.SortAttributes;
// Save parameters to file
Doc := New DOMDocumentClass.Create();
Element := Doc.createElement("SortAtt");
dictSort.SaveTo(Element);
Doc.appendChild(Element);
Doc.save("C:\SortAtt.xml");
End Sub;
After executing the example attribute sorting parameters in the first export scheme are saved to the file C:\SortAtt.xml.
See also: