ForceEmptyValues: Boolean;
The ForceEmptyValues property determines whether to replace the data points, that are missing in the source but present in the consumer, with empty values.
Available values:
True. Data points that are missing in the source but present in the consumer are replaced with Null.
False. Default value. Data points are not replaced.
Executing the example requires that the repository contains a time series database with the TSDB identifier (data source) and a time series database with the TSDB_COPY identifier (data consumer). The time series databases must have matching structures.
Add links to the Cubes and Metabase system assemblies.
Sub UserProc;
Var
Metabase: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Rub: IRubricator;
Callback: MyUpdateCallback;
Begin
// Get current time series database
Metabase := MetabaseClass.Active;
// Create an object for copying a time series database
RubUpdateEx := New CubeMetaUpdateClass.Create As ICubeMetaUpdateEx;
// Set copied time series database
Rub := Metabase.ItemById("TSDB").Bind As IRubricator;
RubUpdateEx.Rubricator := Rub;
// Specify that data is copied with data and nested objects
RubUpdateEx.CopyData := True;
RubUpdateEx.CopyExtraObjects := False;
// Specify repository and time series database, to which data is copied
RubUpdateEx.Metabase := Metabase;
RubUpdateEx.TargetRubricator := Metabase.ItemById("TSDB_COPY").Bind As IRubricator;
// Specify that data points that are missing in the source, but present in the consumer,
// are replaced with Null;
RubUpdateEx.ForceEmptyValues := True;
// Specify that data is copied within one transaction
RubUpdateEx.DisableTransactions := True;
// Specify that custom object is used for handling transactions
Callback := New MyUpdateCallback.Create;
RubUpdateEx.UpdateCallback := Callback;
// Copy
RubUpdateEx.Apply(Null);
End Sub UserProc;
// Class implementing events that occur in transactions during copying
Class MyUpdateCallback: CubeMetaUpdateCallback
// Event that occurs on opening transaction and revision
public Sub OnAfterStartTransaction(Rubricator: IRubricatorInstance; Connection: ISecurityConnection);
Begin
Debug.WriteLine("User " + Connection.UserNameLo + " has started copying");
End Sub OnAfterStartTransaction;
// Event that occurs before closing transaction and revision
Public Sub OnBeforeCommit(Rubricator: IRubricatorInstance; Connection: ISecurityConnection);
Begin
Debug.WriteLine("User " + Connection.UserNameLo + " has finished copying");
End Sub OnBeforeCommit;
End Class MyUpdateCallback;
After executing the example the TSDB time series database data is copied to the TSDB_COPY time series database within one transaction. Data points that are missing in the source but present in the consumer are replaced with Null. The console window displays information about start and finish of copying.
See also: