IDimSelection.ToString

Syntax

ToString(

[Format: String = "";]

[Separator: String = ",";]

[CollectRanges: Boolean = False]): String;

Parameters

Format is optional parameter that determines dictionary attribute identifier, the values of which are to be selected. By default the selection value is organized from the values of the element attribute Name.

Separator is optional parameter that determines the delimiter used for transformation. By default "," is used.

CollectRanges is optional parameter that determines whether the attribute values are grouped into ranges separated by "-" character. By default the value is False, attribute values are not grouped.

Description

The ToString method sets selection value as a string in accordance with the selected parameters.

Comments

To add all dictionary elements to selection, use the IDimSelection.SelectAll method.

Example

Executing the example requires an MDM dictionary with the 6443 key containing attributes with the KEY and NAME identifiers.

Add links to the Metabase and Dimensions system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Dimen: IDimInstance;
    Selection: IDimSelection;
Begin
    MB := MetabaseClass.Active;
    Dimen := MB.Item(6443).Open(NullAs IDimInstance;
    Selection := Dimen.CreateSelection;
    // add all elements to selection:
    Selection.SelectAll;
    // Names of elements:
    Debug.WriteLine(Selection.ToString(Format := "NAME", Separator := ", ", CollectRanges := True));
    // Keys of elements:
    Debug.WriteLine(Selection.ToString(Format := "KEY", Separator := " | ", CollectRanges := False));
End Sub UserProc;

After executing the example the console window shows names and keys of the elements.

See also:

IDimSelection