ScenarioDimension: IDimInstance;
The ScenarioDimension property returns scenario dimension of series.
To get calendar dimension of series, use the ILanerSerie.CalendarDim property.
Executing the example requires that the repository contains a workbook with the WORKBOOK_SCENARIO identifier that contains several series. The time series database that is a data source for the workbook must contain more than one scenario.
Add links to the Dimensions, Express, Laner and Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
WbkObj: IMetabaseObject;
EaxAn: IEaxAnalyzer;
Laner: ILaner;
CalcSerie: ILanerCalculateSerie;
ScenDim: IDimInstance;
Attributes: IDimAttributesInstance;
ScenKey: Integer;
Begin
// Get workbook
mb := MetabaseClass.Active;
WbkObj := mb.ItemById("WORKBOOK_SCENARIO").Edit;
EaxAn := WbkObj As IEaxAnalyzer;
// Get object to set up workbook
Laner := EaxAn.Laner;
// Get the first series of wokbook
CalcSerie := Laner.Series.Item(0) As ILanerCalculateSerie;
// Get scenario dimension of series
ScenDim := CalcSerie.ScenarioDimension;
// Get key of the second scenario in scenario dimension
Attributes := ScenDim.Attributes;
ScenKey := Attributes.item(1).Value(1);
CalcSerie.ScenarioKey := ScenKey;
// Save changes
WbkObj.Save;
End Sub UserProc;
After executing the example the scenario for the first workbook series is changed.
See also: