IVariableStubExecuteResult.Save

Fore Syntax

Save([ValueFlag: Integer = -1]): Variant;

Fore.NET Syntax

Save(ValueFlag: Integer): Object;

Parameters

ValueFlag. Flag that indicates changed data.

Description

The Save method saves data.

Comments

After executing the IVariableStub.Execute method, depending on the EmptyMatrix parameter value, the IVariableStubExecuteResult.Matrix property provides a matrix with data or an empty matrix with data source structure. If any values are changed in the matrix, changes can be saved to the data source by means of the Save method.

By default, the ValueFlag parameter is set to -1, all data in the matrix will be provided with the flag of changed values "1", and the matrix will be saved with this flag. If the ValueFlag parameter is set to 0, the matrix will be considered unchanged, and no data will be saved. If the value greater than zero is sent in the ValueFlag parameter, the data with the specified changed values flag is saved.

The method saves the unique record key in access protocol created after data saving.

Example

Executing the example requires that the repository contains a cube with the STD_CUBE identifier.

Add links to the Cubes, Matrix, Metabase system assemblies. On working with Fore.NET add a link to the ForeSystem system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    Variable: IVariableStub;
    Result: IVariableStubExecuteResult;
    Mat: IMatrix;
    Coord: IMatrixCoord;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    Variable := MB.ItemById("STD_CUBE").Bind As IVariableStub;
    Result := Variable.Execute(Null, -1True);
    //Get empty matrix with cube structure
    Mat := Result.Matrix;
    Mat.ValueFlag := 1;
    Coord := Mat.CreateCoord;
    For i := 0 To Coord.Count - 1 Do
        Coord.Item(i) := 0;
    End For;
    //Change value by specified coordinate
    Mat.Item(Coord) := 1000;
    //Save changes to cube
    Result.Save(Mat.ValueFlag);
End Sub UserProc;

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Variable: IVariableStub;
    Result: IVariableStubExecuteResult;
    Mat: IMatrix;
    Coord: IMatrixCoord;
    i: Integer;
Begin
    MB := Params.Metabase;
    Variable := MB.ItemById["STD_CUBE"].Bind() As IVariableStub;
    Result := Variable.Execute(Null, -1True);
    //Get empty matrix with cube structure
    Mat := Result.Matrix;
    Mat.ValueFlag := 1;
    Coord := Mat.CreateCoord();
    For i := 0 To Coord.Count - 1 Do
        Coord.Item[i] := 0;
    End For;
    //Change value by specified coordinate
    Mat.Item[Coord] := 1000;
    //Save changes to cube
    Result.Save(Mat.ValueFlag);
End Sub;

Executing the example provides a matrix, which structure corresponds to the cube structure. Value in the cell with zero coordinates will be changed. The changed matrix will be saved back to the cube.

See also:

IVariableStubExecuteResult