ICubeMetaLoader.ImportCallback

Fore Syntax

ImportCallback: ICubeMetaloaderImportCallback;

Fore.NET Syntax

ImportCallback: Prognoz.Platform.Interop.Cubes.ICubeMetaloaderImportCallback;

Description

The ImportCallback property determines the object that is used to handle events occurring on time series import.

Comments

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.

Fore Example

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. The import object must be set up for any data source, except for time series database.

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;
    ImpRequestDefDescr: IMetabaseObjectDescriptor;
    ImpRequestDef: IImportRequestDefinition;
    MetaLoader: ICubeMetaLoader;
    CallBack: ImportCallBack;
Begin
    // Get current repository
    Mb := MetabaseClass.Active;
    // Get time series database key
    TSDBKey := mb.GetObjectKeyById("TSDB_I");
    // Get import object
    ImpRequestDefDescr := Mb.ItemByIdNamespace("OBJ_IMPORT", TSDBKey);
    // Get time series import parameters
    ImpRequestDef := ImpRequestDefDescr.Edit As IImportRequestDefinition;
    MetaLoader := ImpRequestDef.ProviderParams As ICubeMetaLoader;
    // Do not use minor transactions
    MetaLoader.DisableTransactions := True;
    // Create an object for handling import events
    CallBack := New ImportCallBack.Create;
    MetaLoader.ImportCallback := CallBack;
    // Import data
    MetaLoader.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.

Fore.NET Example

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;
    ImpRequestDefDescr: IMetabaseObjectDescriptor;
    ImpRequestDef: IImportRequestDefinition;
    MetaLoader: ICubeMetaLoader;
    CallBack: ImportCallBack;
Begin
    // Get current repository
    Mb := Params.Metabase;
    // Get time series database key
    TSDBKey := mb.GetObjectKeyById("TSDB_I");
    // Get import object
    ImpRequestDefDescr := Mb.ItemByIdNamespace["OBJ_IMPORT", TSDBKey];
    // Get time series import parameters
    ImpRequestDef := ImpRequestDefDescr.Edit() As IImportRequestDefinition;
    MetaLoader := ImpRequestDef.ProviderParams As ICubeMetaLoader;
    // Do not use minor transactions
    MetaLoader.DisableTransactions := True;
    // Create an object for handling import events
    CallBack := New ImportCallBack.Create();
    MetaLoader.ImportCallback := CallBack;
    // Import data
    MetaLoader.LoadData();
End Sub;

See also:

ICubeMetaLoader