IVariableStub.CopyScenarioData

Syntax

CopyScenarioData(ScenarioDim: IDimInstance; Source: Integer; Destination: Integer);

Parameters

ScenarioDim. The parameter is not used, it is kept for compatibility.

Source. Scenario key, data from which must be copied.

Destination. Scenario key, to which data must be copied.

Description

The CopyScenarioData method copies data of a scenario to another scenario.

Comments

As the ScenarioDim parameter, the Null value must be passed.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container includes a variable with the OBJ_VAR identifier. The variable contains more than one scenario.

Sub UserProc;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Variable: IVariableStub;

MsVAr: IMsVariable;

S_From, S_To: Integer;

ScenDim: IDimInstance;

AttrIn: IDimAttributesInstance;

N_From, N_To: string;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemByIdNamespace("OBJ_VAR", MB.ItemById("CONT_MODEL").Key).Edit;

MsVAr := MObj As IMsVariable;

ScenDim := MsVAr.ScenarioDimension;

AttrIn := ScenDim.Attributes;

S_From := AttrIn.FindById("SCEN_KEY").Value(0);

N_From := AttrIn.FindById("NAME").Value(0);

S_To := AttrIn.FindById("SCEN_KEY").Value(1);

N_To := AttrIn.FindById("NAME").Value(1);

Variable := MObj As IVariableStub;

Variable.CopyScenarioData(Null, S_From, S_To );

Debug.WriteLine("Data is copied from scenario " + N_From + "' to scenario '" + N_To +'''');

MObj.Save;

End Sub UserProc;

After executing the example data with the variable is copied from one scenario to another. The console window displays a message with indication of scenario names.

See also:

IVariableStub