IVZBaseFormatter.Format

Syntax

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

Parameters

Value. Source string.

params. Array of objects used to insert 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}, " +
        "element value by color scale: {%ColorValue}""17""no data");
    Debug.WriteLine(Format);
    // Get percentage equivalent of the number 0.42
    Format := Formatter.FormatByParam("{0}"0.425"0.00%");
    Debug.WriteLine("Number 0.42, expressed in percent: " + Format);
    { Get exponential format of of number 2011 and
     format of record of number 15258.2 with two decimal digits }

    Format := Formatter.FormatByParams("Exponential format of number 2011: " +
        "{0:0E+0}, format of record with two decimal digits: {1:0.00}"201115258.2"0.00");
    Debug.WriteLine(Format);
    // Get 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