ParseAttribute(Value: Variant; Attribute: IDimAttribute; [Strict: Boolean = False]);
Value. Selection value from which transformation is executed.
Attribute. Dictionary attribute by which selection is formed. A unique index must be created in the dictionary by this attribute.
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 selected, an exception is thrown.
The ParseAttribute method recovers selection from the value passed by the Value parameter.
It is used along with the AttributeToVariant method. Recovery includes values of the attributes passed by the Attribute parameter.
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.AttributeToVariant | IDimSelection.ToVariant | IDimSelection.Parse