SaveEx(FileName: String; Progress: IMetabaseUpdateProgress);
SaveEx(FileName: string; Progress: Prognoz.Platform.Interop.Metabase.IMetabaseUpdateProgress);
FileName. Name of the file, to which a time series database is replicated.
Progress. Object that implements events occurring on replication.
The SaveEx method replicates a time series database into file allowing to handle the events occurring during replication.
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 replication object
RubUpdateEx := New CubeMetaUpdateClass.Create;
// Get time series database
Rub := Mb.ItemById("TSDB").Bind As IRubricator;
// Specify that replicate obtained time series database
RubUpdateEx.Rubricator := Rub;
// Create an object that implements events occurring during replication
Progress := New MyUpdateProgress.Create;
// Execute replication to file
RubUpdateEx.SaveEx("C:\Replication.zip", Progress);
End Sub UserProc;
// Class that implements events that occur during replication
Class MyUpdateProgress: UpdateProgress
// Event that occurs on replication errors
Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
Begin
Debug.WriteLine("Update object replication 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 replicated to the C:\Replication.zip file. If errors occur on replication, they are displayed in the console window.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Rub: IRubricator;
Progress: MyUpdateProgress;
Begin
// Get current repository
Mb := Params.Metabase;
// Create replication object
RubUpdateEx := New CubeMetaUpdateClass.Create();
// Get time series database
Rub := Mb.ItemById["TSDB"].Bind() As IRubricator;
// Specify that replicate obtained time series database
RubUpdateEx.Rubricator := Rub;
// Create an object that implements events occurring during replication
Progress := New MyUpdateProgress.Create();
// Execute replication to file
RubUpdateEx.SaveEx("C:\Replication.zip", Progress);
End Sub;
…
// Class that implements events that occur during replication
Public Class MyUpdateProgress: IMetabaseUpdateProgress
// Event that occurs on replication errors
Public Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
Begin
System.Diagnostics.Debug.WriteLine("Update object copying error '" + Data.Node.Label + "'");
System.Diagnostics.Debug.WriteLine("Error text: " + Data.Error.Message);
If Data.Object <> Null Then
System.Diagnostics.Debug.WriteLine("Error source: " + Data.Object.Id);
System.Diagnostics.Debug.WriteLine("Object key: " + Data.Object.Key.ToString());
End If;
System.Diagnostics.Debug.WriteLine("Object is skipped");
Ignore := True;
End Sub;
Public Sub OnContext(Context: IMetabaseUpdateContext);
Begin
End Sub;
Public Sub OnProgress(Data: IMetabaseUpdateProgressData);
Begin
End Sub;
Public Sub OnAskConstraintsHandling(Node: IMetabaseUpdateNode; Details: String; Var Handling: UpdateDataConstraintsHandlingType);
Begin
End Sub;
Public Sub OnAskReflectRights(Var Cancel: Boolean);
Begin
End Sub;
Public Sub OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
Begin
End Sub;
Public Sub OnSkip(Data: IMetabaseUpdateProgressData);
Begin
End Sub;
Public Sub OnNullLinks(Node: IMetabaseUpdateNode; Links: IMetabaseUpdateNullLinks);
Begin
End Sub;
Public Sub OnBeforeCustomObjectSaveToPef(Resolver: ICustomObjectResolver);
Begin
End Sub;
Public Sub OnAfterApplyCustomObject(Resolver: ICustomObjectResolver);
Begin
End Sub;
End Class MyUpdateProgress;
See also: