SaveEx(FileName: String; Progress: IMetabaseUpdateProgress);
FileName. Name of the file to which the time series database is to be saved.
Progress. Object that implements event occurring on copying.
The SaveEx method copies time series database to file including handling of events that occur during copying.
After executing the example a ZIP archive is created that contains required files with information about time series database and time series data. Specify the path and name of the file together with the ZIP extension as value of the FileName parameter.
Executing the example requires that the repository contains a time series database with the TSDB identifier.
Add links to the Cubes and Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Rub: IRubricator;
Progress: MyUpdateProgress;
Begin
// Get current repository
Mb := MetabaseClass.Active;
// Create a copying object
RubUpdateEx := New CubeMetaUpdateClass.Create;
// Get time series database
Rub := Mb.ItemById("TSDB").Bind As IRubricator;
// Determine copying time series database
RubUpdateEx.Rubricator := Rub;
// Create an object that implements events that occur during copying
Progress := New MyUpdateProgress.Create;
// Save to file
RubUpdateEx.SaveEx("C:\Replication.zip", Progress);
End Sub UserProc;
// Class that implements events that occur during copying
Class MyUpdateProgress: UpdateProgress
// Event occurring on copying errors
Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
Begin
Debug.WriteLine("Update object copying error '" + Data.Node.Label + "'");
Debug.WriteLine("Error text: " + Data.Error.Message);
If Data.Object <> Null Then
Debug.WriteLine("Error source: " + Data.Object.Id);
Debug.WriteLine("Object key: " + Data.Object.Key.ToString);
End If;
Debug.WriteLine("Object is skipped");
Ignore := True;
End Sub OnError;
End Class MyUpdateProgress;
After executing the example the TSDB time series database is saved to the C:\Replication.zip file. If errors occur on copying, they are displayed in the console window.
See also: