ForceEmptyValues: Boolean;
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 replication of time series database
RubUpdateEx := New CubeMetaUpdateClass.Create As ICubeMetaUpdateEx;
// Set replicated time series database
Rub := Metabase.ItemById("TSDB").Bind As IRubricator;
RubUpdateEx.Rubricator := Rub;
// Specify that data is replicated with data and nested objects
RubUpdateEx.CopyData := True;
RubUpdateEx.CopyExtraObjects := False;
// Specify repository and time series database, to which data is replicated
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 replicated within one transaction
RubUpdateEx.DisableTransactions := True;
// Specify that custom object is used for handling transactions
Callback := New MyUpdateCallback.Create;
RubUpdateEx.UpdateCallback := Callback;
// Replicate
RubUpdateEx.Apply(Null);
End Sub UserProc;
// Class that implements events that occur in transactions during replication
Class MyUpdateCallback: CubeMetaUpdateCallback
// Event that occurs on opening transaction and revision
public Sub OnAfterStartTransaction(Rubricator: IRubricatorInstance; Connection: ISecurityConnection);
Begin
Debug.WriteLine("User " + Connection.UserNameLo + " started replication");
End Sub OnAfterStartTransaction;
// Event that occurs before closing transaction and revision
Public Sub OnBeforeCommit(Rubricator: IRubricatorInstance; Connection: ISecurityConnection);
Begin
Debug.WriteLine("User " + Connection.UserNameLo + " finished replication");
End Sub OnBeforeCommit;
End Class MyUpdateCallback;
After executing the example the TSDB time series database data is replicated 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 replication.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cubes;
…
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Rub: IRubricator;
Callback: MyUpdateCallback;
Begin
// Get current time series database
Metabase := Params.Metabase;
// Create an object for replication of time series database
RubUpdateEx := New CubeMetaUpdateClass.Create() As ICubeMetaUpdateEx;
// Set replicated time series database
Rub := Metabase.ItemById["TSDB"].Bind() As IRubricator;
RubUpdateEx.Rubricator := Rub;
// Specify that data is replicated with data and nested objects
RubUpdateEx.CopyData := True;
RubUpdateEx.CopyExtraObjects := False;
// Specify repository and time series database, to which data is replicated
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 replicated within one transaction
RubUpdateEx.DisableTransactions := True;
// Specify that custom object is used for handling transactions
Callback := New MyUpdateCallback.Create();
RubUpdateEx.UpdateCallback := Callback;
// Replicate
RubUpdateEx.Apply(Null);
End Sub;
…
// Class that implements events that occur in transactions during replication
Public Class MyUpdateCallback: ICubeMetaUpdateCallback
// Event that occurs on opening transaction and revision
Public Sub OnAfterStartTransaction(Rubricator: IRubricatorInstance; Connection: ISecurityConnection);
Begin
System.Diagnostics.Debug.WriteLine("User " + Connection.UserNameLo + " started replication");
End Sub OnAfterStartTransaction;
// Event that occurs before closing transaction and revision
Public Sub OnBeforeCommit(Rubricator: IRubricatorInstance; Connection: ISecurityConnection);
Begin
System.Diagnostics.Debug.WriteLine("User " + Connection.UserNameLo + " finished replication");
End Sub OnBeforeCommit;
End Class MyUpdateCallback;
See also: