IDimSelection.ToString

Fore Syntax

ToString(

[Format: String = "";]

[Separator: String = ",";]

[CollectRanges: Boolean = False]): String;

Fore.NET Syntax

ToString(

Format: string;

Separator: string;

CollectRanges: boolean): 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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Dimensions;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Dimen: IDimInstance;
    Selection: IDimSelection;
Begin
    MB := Params.Metabase;
    Dimen := MB.Item[6443].Open(NullAs IDimInstance;
    Selection := Dimen.CreateSelection();
    // add all elements to selection:
    Selection.SelectAll();
    // Names of elements:
    System.Diagnostics.Debug.WriteLine(Selection.ToString("NAME"", "True));
    // Keys of elements:
    System.Diagnostics.Debug.WriteLine(Selection.ToString("KEY"" | "False));
End Sub;

See also:

IDimSelection