SaveElementDependencies(Value: IMbElementDependencies; [ObjectKey: Integer = -1]);
Value. Dependencies, lists of which are added by the dependencies of the elements in the selection.
ObjectKey. Object key, dependencies for which should be determined. By default, value -1 is passed, object key should be set in the Where condition of the saved dependencies collection Value.
The SaveElementDependencies method saves a collection of dependencies from elements contained in the selection.
This method is effective for selection, received from MDM dictionaries. The dictionary requires that the opportunity to track elements references is turned on.
Executing the example requires a form with a button named Button1 positioned on it, the DimensionTree component named DimensionTree1 and any data source for DimensionTree1. Data source is connected to MDM dictionary, that tracks elements references. The repository has also an object with the Report_1 identifier, that tracks dependencies on MDM dictionary elements.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
Sel: IDimSelection;
Obj: IMetabaseObjectDescriptor;
Depends: IMbElementDependencies;
Begin
MB := MetabaseClass.Active;
Sel := DimensionTree1.Selection;
Obj := MB.ItemById("Report_1");
Depends := Obj.ElementDependencies;
Sel.SaveElementDependencies(Depends);
Depends.Database.Update(Depends);
End Sub Button1OnClick;
After executing the example list of element dependencies is updated when the button for the Report_1 object is pressed. The list of dependencies is added by the element dependencies selected in the DimensionTree1 component.
See also: