Parse(Value: Variant; [Strict: Boolean = False]);
Value. Selection value from which transformation is executed.
Strict. Optional parameter, that determines whether an exception is thrown if the Value value has elements absent in the current selection. By default the property is set to False, missing elements are run. If the True value is set, an exception is thrown.
The Parse method restores selection from the value passed by the Value parameter.
Is used along with the ToVariant method. Recovery is performed by the attribute value - Identifier.
Executing the example requires a dictionary with the D_TO identifier containing selection schema.
Sub Main;
Var
MB: IMetabase;
MDes: IMetabaseObjectDescriptor;
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.ToVariant | IDimSelection.AttributeToVariant | IDimSelection.ParseAttribute