SetValueDimension(Instance: IDimInstance): IMsDimIteratorFilteredDimension;
Instance. Data source dimension of data consumer.
The SetValueDimension method sets data source dimension of the data consumer, for which filtering data source value should be linked.
It is used in calculation algorithms on setting up additional filtering by data of calculation block. For additional filtering of data consumer dimension elements by values of the specified attribute, bind values of filtering data source. When additional filtering is used, data consumer dimension elements selection depends on values of selected dimension elements of the selected data source and is taken into account in algorithm calculation.
For details see the Setting Up Data Filtering section.
To specify data source attribute of data consumer, use the IMsDimIterateByDataStub.ValueDimAttr property.
Executing the example requires that the repository contains a calculation algorithm. The calculation algorithm contains a calculation block, in which data consumer and filtering data source are selected for additional filtering of data consumer dimension elements by values of the specified attribute. Make sure that the data consumer contains an MDM dictionary with the DIMENSION identifier, and the calculation algorithm contains a calculation block metamodel with the 12345 key.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Meta: IMsMetaModel;
CalculationChain: IMsCalculationChainEntries;
Iter: IMsCalculationChainMultiDimIterator;
Dim: IDimInstance;
Param: IMsDimIterateByDataOptions;
Stub: IMsDimIterateByDataStub;
Begin
MB := MetabaseClass.Active;
// Get data consumer dimension (MDM dictionary)
Dim := MB.ItemById("DIMENSION").Open(Null) As IDimInstance;
// Get metamodel from calculation algorithm
Meta := MB.Item(12345).Edit As IMsMetaModel;
// Get metamodel calculation chain and the first iteration
CalculationChain := Meta.CalculationChain;
Iter := CalculationChain.Item(0) As IMsCalculationChainMultiDimIterator;
// Get iteration parameters
Param := Iter.IterateByData;
// Set value binding by attribute
Stub := Param.Stubs.Item(0);
Stub.SetValueDimension(Dim);
Stub.ValueDimAttr := "KEY";
// Save changes
Meta.MetabaseObject.Save;
// Display dimension name in the console
Debug.WriteLine(Stub.ValueDimension.Name);
End Sub UserProc;
After executing the example, the value of the KEY attribute contained in the dimension of the data consumer with the DIMENSION identifier is linked to the filtering data source. The console displays name of the bound data consumer dimension.
See also: