Add(NodeType: MetabaseUpdateNodeType): IMetabaseUpdateNode;
NodeType - a type of the update object that is being created.
The Add method adds an object to the update structure.
Executing the example requires that the repository contains tables with the Table_1 and Table_2 identifiers and forms with the Form_1 and Form_2 identifiers.
Sub Main;
Var
MB: IMetabase;
Update: IMetabaseUpdate;
Root, Folder1, Folder2: IMetabaseUpdateFolderNode;
TableObj: IMetabaseUpdateDataObjectNode;
FormObj: IMetabaseUpdateObjectNode;
Begin
MB := MetabaseClass.Active;
Update := MB.CreateUpdate;
Root := Update.RootFolder;
//Folders creating
Folder1 := Root.Add(MetabaseUpdateNodeType.Folder) As IMetabaseUpdateFolderNode;
Folder1.Label := "Tables";
Folder2 := Root.Add(MetabaseUpdateNodeType.Folder) As IMetabaseUpdateFolderNode;
Folder2.Label := "Forms";
//Tables adding
TableObj := Folder1.Add(MetabaseUpdateNodeType.DataObject) As IMetabaseUpdateDataObjectNode;
TableObj.Object := MB.ItemById("Table_1");
TableObj.Label := TableObj.Object.Name;
TableObj.Method := MetabaseUpdateMethod.All;
TableObj := Folder1.Add(MetabaseUpdateNodeType.DataObject) As IMetabaseUpdateDataObjectNode;
TableObj.Object := MB.ItemById("Table_2");
TableObj.Label := TableObj.Object.Name;
TableObj.Method := MetabaseUpdateMethod.All;
//Forms adding
FormObj := Folder2.Add(MetabaseUpdateNodeType.Object) As IMetabaseUpdateObjectNode;
FormObj.Object := MB.ItemById("Form_1");
FormObj.Label := FormObj.Object.Name;
FormObj := Folder2.Add(MetabaseUpdateNodeType.Object) As IMetabaseUpdateObjectNode;
FormObj.Object := MB.ItemById("Form_2");
FormObj.Label := FormObj.Object.Name;
Update.SaveToFileNF("c:\Object.pefx");
End Sub Main;
After executing this example a new update is created. Two tables and two forms are included in the update. Two folders are created in the update structure for objects arranging.
See also: