ControlledBy: IMetabaseObjectParam;
None;
The ControlledBy property determines the parameter, which manages synchronization index.
Using the property enables the user to set synchronized dimensions values, which will open the report.
Executing the example requires that the repository contains a dashboard with the DASHBOARD_PARAM identifier. Synchronization of only one dimension should be set up in this dashboard. Synchronized dimension must contain the KEY attribute.
Sub UserProc;
Var
mb: IMetabase;
Obj: IMetabaseObject;
Adhoc: IAdhocReport;
Sync: IAdhocSynchronization;
Dims: IAdhocDimsSynchronization;
DimIndex: IAdhocDimSyncIndex;
Params: IMetabaseObjectParams;
Param: IMetabaseObjectParam;
BM: IBindingManager;
DimCombo: IBindingDimCombo;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get dashboard
Obj := mb.ItemById("DASHBOARD_PARAM").Edit;
Adhoc := Obj As IAdhocReport;
// Get dashboard parameters collection
Params := Obj.Params;
// Clear parameters collection
Params.Clear;
// Get data about synchronization of dimensions
Sync := Adhoc.Synchronization;
// Get synchronized dimensions collection
Dims := Sync.Dimensions;
// Get the first synchronized dimension
DimIndex := Dims.Item(0);
// Create a new parameter
Param := Params.Add;
// Determine parameter type
Param.DataType := DbDataType.Integer;
// Set up parameter values editor
BM := New BindingManager.Create;
// Determine that it will be dictionary drop-down list
DimCombo := BM.CreateByUi("DimCombo") As IBindingDimCombo;
// Determine dictionary identifier, which will be managed by the parameter
DimCombo.ObjectDefined := True;
DimCombo.Object := DimIndex.Selection.Dimension.Ident;
// Determine dictionary attribute managing value
DimCombo.ValueAttributeDefined := True;
DimCombo.ValueAttribute := "KEY";
// Set configured value editor for parameter
Param.Binding.AsString := DimCombo.AsString;
// Determine that created parameter manages synchronized dimension
DimIndex.ControlledBy := Param;
// Save changes
Obj.Save;
End Sub UserProc;
After executing the example on dashboard opening the parameter value managing dimension synchronization must be set.
See also: