IDimSelection.ToVariant

Syntax

ToVariant: Variant;

Description

The ToVariant method sets selection value.

Comments

The Selection value is set as an array to be used in the Parse method. The value is generated by the attribute value - ID.

Example

Executing the example requires a dictionary with the D_TO identifier containing a selection schema.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Dimen: IDimInstance;

DimenSelectSchema: IDimSelectionSchema;

SelectSchemaPrimit: IDimSelectionSchemaPrimitive;

Selection: IDimSelection;

i: Integer;

v: Variant;

Begin

MB := MetabaseClass.Active;

MDes := MB.ItemById("D_TO");

Dimen := MDes.Open(Null) As IDimInstance;

Selection := Dimen.CreateSelection;

For i := 0 To 9 Do

Selection.SelectElement(i, False);

End For;

v := Selection.ToVariant;

If MDes.Children.Count <> 0 Then

MObj := MDes.Children.Item(0).Edit;

DimenSelectSchema := MObj As IDimSelectionSchema;

SelectSchemaPrimit := DimenSelectSchema.Add(SelectionPrimitiveType.Specified);

(SelectSchemaPrimit As IDimListSelectionPrimitive).Selection.Parse(v);

MObj.Save;

End If;

End Sub Main;

After executing the example the selection schema of the D_TO dictionary contains a primitive with the selection of the first 10 dictionary elements.

See also:

IDimSelection | IDimSelection.Parse | IDimSelection.AttributeToVariant | IDimSelection.ParseAttribute