OnBeforeCustomObjectSaveToPef(Resolver: ICustomObjectResolver);
Resolver. Object that is used to work with a custom object.
The OnAfterApplyCustomObject method implements the event that occurs after applying custom object update, but before it is saved to repository.
The event occurs for each custom object contained in the update.
Executing the example requires that the file system contains the C:\CustomObjData.pefx update file. This file must contain a custom object, in which any data is written. It is also required to have the C:\From.txt text file containing data that must be written to custom object.
Add links to the Metabase system assembly.
Sub UserProc;
Var
Mb: IMetabase;
Update: IMetabaseUpdate;
Progress: MyUpdateProgress;
Begin
// Get the current repository
Mb := MetabaseClass.Active;
// Create an update
Update := Mb.CreateUpdate;
// Load update parameters from file
Update.LoadFromFileNF("C:\CustomObjData.pefx");
// Create an object that implements events that occur during update
Progress := New MyUpdateProgress.Create;
// Execute update
Update.ApplyEx(Progress, Null);
End Sub UserProc;
// Class that implements events that occur during update
Class MyUpdateProgress: UpdateProgress
// Event that occurs after applying custom object update,
// but before it is saved to repository
Sub OnAfterApplyCustomObject(Resolver: ICustomObjectResolver);
Begin
// Read data from custom object to text file
Resolver.ReadToFile("C:\To.txt");
// Write data to custom object from text file
Resolver.WriteFromFile("C:\From.txt");
End Sub OnAfterApplyCustomObject;
End Class MyUpdateProgress;
After executing the example the C:\CustomObjData.pefx update is applied. Custom object data in the update is downloaded to the C:\To.txt file, data from the C:\From.txt file is written to the object.
See also: