IDimSelection.AttributeToVariant

Syntax

AttributeToVariant(Attribute: IDimAttribute): Variant;

Parameters

Attribute - dictionary attributes values of which are to be selected. A unique index must be created in the dictionary by this attribute.

Description

The AttributeToVariant method sets selection value by values of the specified elements' attribute.

Comments

Selection value is created as an array to be used in the ParseAttribute method. Selection includes values of the attribute passed by the Attribute parameter.

Example

Executing the example requires a form, a button named Button1 positioned on this form, the UiDimension component named UiDimension1, and some components that use data of the UiDimension component. A selection schema is available for the dictionary loaded to UiDimension. The first primitive contains selection of listed elements.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Dim: IDimensionModel;

MObj: IMetabaseObject;

DimenSelectSchema: IDimSelectionSchema;

SelectSchemaPrimit: IDimSelectionSchemaPrimitive;

Sel: IDimSelection;

Attr: IDimAttribute;

v: Variant;

Begin

Dim := UiDimension1.Dimension;

MObj := (Dim As IMetabaseObject).Children.Item(0).Bind;

DimenSelectSchema := MObj As IDimSelectionSchema;

SelectSchemaPrimit := DimenSelectSchema.Item(0);

Sel := (SelectSchemaPrimit As IDimListSelectionPrimitive).Selection;

Attr := Dim.Attributes.Name;

v := Sel.AttributeToVariant(Attr);

UiDimension1.Selection.ParseAttribute(v, Attr);

End Sub Button1OnClick;

After executing the example clicking the button sets selection in the UiDimension1 component that matches selection in primitive of dictionary selection schema. Transformation is carried out by the Name attribute.

See also:

IDimSelection | IDimSelection.ParseAttribute | IDimSelection.ToVariant | IDimSelection.Parse