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 ValueFlag parameter is set to the value more than zero, the data with the specified flag of changed values will be saved.

Fore Example

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

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;

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.

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;
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;

See also:

IVariableStubExecuteResult