TableObject: IMetabaseObjectDescriptor;
TableObject: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;
The TableObject property determines repository table, into which data is exported.
The IRdsExportSchema.TableName property determines a physical name of a table, to which the data is exported.
Executing the example requires a table with the OBJ_EXP identifier. There must be also the MDM repository with the RDS_REPO identifier that contains the MDM dictionary with the EXPORT identifier. Identifiers and field types of the OBJ_EXP table and of the EXPORT dictionary match.
Add links to the Metabase, Rds, Db system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict: IRdsDictionary;
Export: IRdsExportSchemas;
SchemaExport: IRdsExportSchema;
Attrs: IRdsAttributes;
TableObj: IMetabaseObjectDescriptor;
Table: ITable;
DictInst: IRdsDictionaryInstance;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("EXPORT", MB.ItemById("RDS_REPO").Key).Edit;
Dict := MObj As IRdsDictionary;
Attrs := Dict.Attributes;
Export := Dict.ExportSchemas;
SchemaExport := Export.Add;
SchemaExport.Id := MB.GenerateId("Export1");
SchemaExport.Name := Export scheme #1;
SchemaExport.Mappings(Attrs.Key).FieldName := "Key";
SchemaExport.Mappings(Attrs.Name).FieldName := "Name";
SchemaExport.Mappings(Attrs.Order).FieldName := "Ord";
SchemaExport.Mappings(Attrs.ParentKey).FieldName := "Parent_key";
TableObj := MB.ItemById("OBJ_EXP");
Table := TableObj.Bind As ITable;
SchemaExport.TableObject := TableObj;
SchemaExport.TableName := Table.NativeName;
MObj.Save;
DictInst := Dict.Open(Null);
DictInst.ExportData(SchemaExport);
End Sub UserProc;
After executing the example a new export scheme is created in the MDM dictionary. Attribute values of the EXPORT dictionary are exported in same-name fields of the OBJ_EXP table. Export will be executed.
Executing the example requires a table with the OBJ_EXP identifier. There must be also the MDM repository with the RDS_REPO identifier that contains the MDM dictionary with the EXPORT identifier. Identifiers and field types of the OBJ_EXP table and of the EXPORT dictionary match.
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict: IRdsDictionary;
Export: IRdsExportSchemas;
SchemaExport: IRdsExportSchema;
Attrs: IRdsAttributes;
TableObj: IMetabaseObjectDescriptor;
Table: ITable;
DictInst: IRdsDictionaryInstance;
Begin
MB := Params.Metabase;
MObj := MB.ItemByIdNamespace["EXPORT", MB.ItemById["RDS_REPO"].Key].Edit();
Dict := MObj As IRdsDictionary;
Attrs := Dict.Attributes;
Export := Dict.ExportSchemas;
SchemaExport := Export.Add();
SchemaExport.Id := MB.GenerateId("Export1", 0);
SchemaExport.Name := Export scheme #1;
SchemaExport.Mappings[Attrs.Key].FieldName := "Key";
SchemaExport.Mappings[Attrs.Name].FieldName := "Name";
SchemaExport.Mappings[Attrs.Order].FieldName := "Ord";
SchemaExport.Mappings[Attrs.ParentKey].FieldName := "Parent_key";
TableObj := MB.ItemById["OBJ_EXP"];
Table := TableObj.Bind() As ITable;
SchemaExport.TableObject := TableObj;
SchemaExport.TableName := Table.NativeName;
MObj.Save();
DictInst := Dict.Open(Null);
DictInst.ExportData(SchemaExport);
End Sub;
After executing the example a new export scheme is created in the MDM dictionary. Attribute values of the EXPORT dictionary are exported in same-name fields of the OBJ_EXP table. Export will be executed.
See also: