ICubeCallbackSaveArgument.Origin

Syntax

Origin: String;

Description

The Origin property returns the key of the object that initializes cube data changes.

Comments

Cube data can be changed by the Interactive Data Entry Forms and Calculation Algorithms extensions:

The key of the object that initiates data change can be obtained only via the cube data save handler connected to the cube. To connect the handler, use the IStandardCube.SetDefaultCallback property.

The example of the cube data save handler with the use of the ICubeCallbackSaveArgument.Origin property:

Public Class CubeSaveCallBack: CubeCallBack
    // Handle the event that occurs before cube saving
    Sub OnBeforeSave(callbackSaveArg: ICubeCallbackBeforeSaveArgument);
    Begin
        //...
        Debug.WriteLine("Event that occurs before cube saving is executed");
    End Sub OnBeforeSave;

    // Handle the event that occurs after cube data saving
    Sub OnAfterSave(callbackSaveArg: ICubeCallbackSaveArgument);
    Begin
        Debug.WriteLine("Key of the object that changed cube data: " + callbackSaveArg.Origin);
        Debug.WriteLine("Event that occurs after cube saving is executed");
    End Sub OnAfterSave;
End Class CubeSaveCallBack;

After executing the example the key of the object was obtained that changed cube data on its saving.

Example

Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier and a calculation algorithm with the ALGORITHM identifier. The calculation algorithm should satisfy the following conditions:

The repository should also contain a unit with the CUBESAVECALLBACK identifier that is a handler of saving data to cube. The example of unit contents is given in the Comments section.

Add links to the Algo, Cubes, Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.

Sub UserProc;
Var
    MB: IMetabase;
    MObj, Module: IMetabaseObject;
    Cube: IStandardCube;
    Algo: ICalcObject;
    CalcAlgo: ICalcAlgorithm;
    CalcResult: IAlgorithmCalculationResult;
Begin
    MB := MetabaseClass.Active;
    // Get cube
    MObj := MB.ItemById("STD_CUBE").Edit;
    Cube := MObj As IStandardCube;
    // Get unit - handler of saving data to cube
    Module := MB.ItemById("CUBESAVECALLBACK").Bind;
    // Connect handler to cube
    Cube.SetDefaultCallback(Module, "CubeSaveCallBack");
    // Save changes in cube
    MObj.Save;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM").Bind;
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Calculate algorithm
    CalcResult := CalcAlgo.Calculate;
End Sub UserProc;

After executing the example, a handler of data saving is connected to the cube, which returns the key of the object that changed cube data. The console displays the corresponding object key after algorithm calculation. For example:

Key of the object that changed cube data: 305519

See also:

ICubeCallbackSaveArgument