LevelValue: Double;
The LevelValue property determines the initial value to be used to calculate the Level function.
The default value is 100.
Executing the example requires that the repository contains a modeling container with the MS identifier containing a model with the MODEL_AGGR identifier. This model must be calculated by extended aggregation method.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Aggr: IMsCrossDimensionAggregationTransform;
strsGen: IMsFormulaStringGenerator;
Options: IMsCrossDimensionAggregationOptions;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get model
Model := mb.ItemByIdNamespace("MODEL_AGGR", MsKey).Edit As IMsModel;
// Get model parameters
Transform := Model.Transform;
// Get model calculation method
Formula := Transform.FormulaItem(0);
Aggr := Formula.Method As IMsCrossDimensionAggregationTransform;
// Set aggregation calculation method
Aggr.AgregationMethod := MsAgregationMethodType.Sum;
// Get additional aggregation calculation parameters
Options := Aggr.Options;
// Set threshold value to calculate aggregation relevance
Options.Threshold := 0;
// Specify that use the Level function
Options.Level := True;
// Set basic value for calculation of the Level function
Options.LevelValue := 90;
// Specify that use the Rebase function
Options.Rebase := True;
// Set basic period for the Rebase function calculation
Options.RebaseDate := "2001A";
// Specify that aggregation is calculated taking into account data hierarchy
Options.FollowHierarchy := True;
// Specify that aggregation is calculated only one level down the hierarchy
Options.IncludeOnlyChild := True;
// Specify that source element is considered in aggregation
Options.IncludeParent := True;
// Create an object for generation of string view of model calculation method
strsGen := Formula.CreateStringGenerator;
// Specify that full names are used in variable names
strsGen.ShowFullVariableNames := True;
// Generate string view of method and display it in the console window
Debug.WriteLine("Aggregation expression: " + strsGen.Execute);
// Save changes in model
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the following model parameters will be changed:
The Level function is used.
The Rebase function with basic period - 2001, calculation step - years is used.
The threshold for aggregation relevance is set.
Aggregation is calculated ignoring the missing data treatment method.
Aggregation is calculated considering hierarchy one level down and considering source element.
The expression, by which aggregation is calculated, is displayed in the console window. For example:
Aggregation expression: World for publication|BCA[t] = Rebase(Level(Sum((BCA[t]) * (BCI[t])) / Sum(BCI[t])), 2001A)
See also: