UserComponents: IValidationUserComponents;
The UserComponents property returns the collection of user validation components.
By default, the validation filter does not contain user components.
Executing the example requires that the repository contains a time series database with the FC_COMM identifier. The database contains a validation filter with the VALIDATION_F identifier. The database must also contain two mandatory attributes referring to a dictionary.
For correct execution of example add links to the Metabase, Ms, Cubes, Dimensions system assemblies.
Sub UserProc;
Var
mb: IMetabase;
RubrDescr: IMetabaseObjectDescriptor;
val: IValidationFilter;
stub: IVariableStub;
UserComponents: IValidationUserComponents;
usComponent: IValidationUserComponent;
selset: IDimSelectionSet;
dimInstDescr: IMetabaseObjectDescriptor;
dimInst: IDimInstance;
sel: IDimSelection;
selSetF: IDimSelectionSetFactory;
Begin
mb := MetabaseClass.Active;
RubrDescr := mb.ItemById("FC_COMM");
val := mb.ItemByIdNamespace("VALIDATION_F", RubrDescr.Key).Edit As IValidationFilter;
stub := RubrDescr.Bind As IVariableStub;
UserComponents := val.UserComponents;
If UserComponents.Count > 0 Then
UserComponents.Clear;
End If;
usComponent := UserComponents.Add;
Debug.WriteLine("Key of user validation component: " + usComponent.Key.ToString);
usComponent.Tag := "Selection of all elements";
usComponent.Kind := ValidationUserComponentKind.Selection;
selSetF := New DimSelectionSetFactory.Create;
selset := selSetF.CreateDimSelectionSet;
usComponent.Selection := selset;
selset := usComponent.Selection;
dimInstDescr := stub.Dimension(0) As IMetabaseObjectDescriptor;
dimInst := dimInstDescr.Open(Null) As IDimInstance;
sel := selset.Add(dimInst);
sel.SelectAll;
dimInstDescr := stub.Dimension(0) As IMetabaseObjectDescriptor;
dimInst := dimInstDescr.Open(Null) As IDimInstance;
sel := selset.Add(dimInst);
sel.SelectAll;
(val As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the collection of custom components is cleared for the validation filter. Then a component set according to selection of the time series database is added to the collection. The key of added component is displayed in the console window.
See also: