In different cube types, control of parametric dimensions is implemented using other cube dimensions. In such a case, value of selected dimension attribute is sent as parameter value. This behavior can be also implemented at dictionary level using dictionary parameters and macro implementing necessary behavior.
As an example, create two dictionaries:
Dictionary with list of regions (MDM table dictionary, the DICT_REGION identifier):
Dictionary with list of cities located in each region (table dictionary, the DICT_CITY identifier):
In dictionary with cities additional attribute with regions codes to which belongs each city is created. In order to set up control of the dictionary with cities basing on selected regions, execute following actions:
In the DICT_CITY dictionary create parameter (the TERRITORY identifier) with custom type of data, in display parameters set editor - Drop-down dictionary menu. Select DICT_REGION as a dictionary. Obtained link row should look as follows: UI="DimCombo" ID="DICT_REGION" ATTRIBUTEVALUE="KEY".
Create unit (the M_FILTER identifier) where will be controlling macro. Add the following code in it:
Function CheckTerritoryCode(Current: Variant; Selected: Variant): Boolean;
Var
Arr: Array;
Begin
//Get key list and its transformation in array
Arr := Selected As Array;
//Check territories codes
If Arr.IndexOf(Current) <> -1 Then
Return True
Else
Return False
End If;
End Function CheckTerritoryCode;
On the Block Binding tab determine created unit and macro as filter expression. As macro parameters determine identifier of the attribute with territories codes and parameters created on the first step: M_FILTER.CheckTerritoryCode(DICT_CITY.TerrCode, :TERRITORY).
On opening of the DICT_CITY dictionary the dialog box to determine parameters values will be displayed. In the dialog box drop-down list select requested regions. After clicking the OK button the CheckTerritoryCode macro will be called for each element of the DICT_CITY dictionary. Key of the territory to which corresponds the city and array of keys of selected territories is sent to macro. If city corresponds to selected territory, the macro returns True, otherwise - False. In output list of elements only the cities with True returned by macro will be kept.
See also: