ImportCallback: ICubeMetaloaderImportCallback;
ImportCallback: Prognoz.Platform.Interop.Cubes.ICubeMetaloaderImportCallback;
The ImportCallback property determines the object that is used to handle events occurring on time series import.
The event handler is not used by default, that is, the ImportCallback property is set to Null.
NOTE. Value of the ImportCallback property is not saved.
The handler is implemented as a custom class where all methods of the ICubeMetaloaderImportCallback interface must be redetermined, and which inherits from the Object class and the ICubeMetaloaderImportCallback interface. If the custom class inherits from the Object and CubeMetaloaderImportCallback classes, only the required methods of the CubeMetaloaderImportCallback class can be redetermined.
Executing the example requires that the repository contains a time series database with the TSDB_I identifier. This database must contain an import object with the OBJ_IMPORT identifier.
Add links to the Cubes and Metabase system assemblies. The example also uses the ImportCallBack class, which description is given in ICubeMetaloaderImportCallback.OnAfterStartTransaction.
Sub UserProc;
Var
mb: IMetabase;
TSDBKey: Integer;
Inst: IImportRequestInstance;
CallBack: ImportCallBack;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get time series database key
TSDBKey := mb.GetObjectKeyById("TSDB_I");
// Get time series import parameters
Inst := mb.ItemByIdNamespace("OBJ_IMPORT", TSDBKey).Open(Null) As IImportRequestInstance;
// Do not use minor transactions
Inst.DisableTransactions := True;
// Create an object for handling import events
CallBack := New ImportCallBack.Create;
Inst.ImportCallback := CallBack;
// Import data
Inst.LoadData;
End Sub UserProc;
After executing the example data is imported to the TSDB_I time series database by the settings determined in the OBJ_IMPORT import object. Import is executed in one transaction.
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;
TSDBKey: uinteger;
Inst: IImportRequestInstance;
CallBack: ImportCallBack;
Begin
// Get current repository
mb := Params.Metabase;
// Get time series database key
TSDBKey := mb.GetObjectKeyById("TSDB_I");
// Get time series import parameters
Inst := mb.ItemByIdNamespace["OBJ_IMPORT", TSDBKey].Open(Null) As IImportRequestInstance;
// Do not use minor transactions
Inst.DisableTransactions := True;
// Create an object for handling import events
CallBack := New ImportCallBack.Create();
Inst.ImportCallback := CallBack;
// Import data
Inst.LoadData();
End Sub;
See also: