IVZBaseFormatter.Format

Syntax

Format(Value: String, params: IVZDataArray, DefaultFormat: String): String;

Parameters

Value. Source string.

params. Array of objects for inserting text equivalents of their values to the source string.

DefaultFormat. Default data format.

Description

The Format method replaces each format element in the selected string with a text equivalent of corresponding object value from selected array.

Comments

The following objects (parameters) can be used for the IVZBubbleTree bubble tree in the source string: Name (bubble name), SizeTitle (size indicator name), SizeValue (size indicator value), ColorTitle (color indicator name), ColorValue (color indicator value), TextTitle (text indicator name), TextValue (text indicator value), ChildsCount (number of bubble's children).

The following objects (parameters) can be used for the IVZTreeMap tree map in the source string: Name (bubble name), SizeTitle (size indicator name), SizeValue (size indicator value), HeightTitle (height indicator name), HeightValue (height indicator value), ColorTitle (color indicator name), ColorValue (color indicator value), TextTitle (text indicator name), TextValue (text indicator value), ChildsCount (number of bubble's children).

Example

Executing the example requires that the repository contains an express report with the EXPRESS_IVZBASEFORMATTER identifier that contains a bubble tree.

Add links to the Express, Metabase, Visualizators system assemblies.

Sub UserProc;
Var
    Metabase: IMetabase;
    Analyzer: IEaxAnalyzer;
    BubbleTree: IVZBubbleTree;
    Formatter: IVZBaseFormatter;
    Format: String;
    Params: IVZDataArray;
Begin
    // Get repository
    Metabase := MetabaseClass.Active;
    // Get express report
    Analyzer := Metabase.ItemById("EXPRESS_IVZBASEFORMATTER").Edit As IEaxAnalyzer;
    // Get bubble tree
    BubbleTree := Analyzer.BubbleTree.BubbleTree;
    { Get region name by its identifier and
    value by color scale }

    Formatter := BubbleTree.Formatter;
    Format := Formatter.FormatById("Region: {%Name}, " +
        "item value by color scale: {%ColorValue}""17""no data");
    Debug.WriteLine(Format);
    // Get percentage expression of the 0.425 number
    Format := Formatter.FormatByParam("{0}"0.425"0.00%");
    Debug.WriteLine("Number 0.42, expressed in percent: " + Format);
    { Get exponential format of record of number 2011 and
    record of the 15258.2 number with two decimal places }

    Format := Formatter.FormatByParams("Exponential format of record of number 2011: " +
        "{0:0E+0}, record with two decimal places: {1}"201115258.2"0.00");
    Debug.WriteLine(Format);
    // Obtain records of two phone numbers in a user-friendly format
    Params := New VZDataArray.Create;
    Params.Add(89209242536);
    Params.Add(84922444090);
    Format := Formatter.Format("Contact phones: {0}; {1:#(####)##-##-##}", Params, "#-###-###-##-##");
    Debug.WriteLine(Format);
End Sub UserProc;

After executing the example the following is displayed in the development environment console:

See also:

IVZBaseFormatter