Format(Value: String, params: IVZDataArray, DefaultFormat: String): String;
Format(Value: string, params: Prognoz.Platform.Interop.Visualizators.VZDataArray, DefaultFormat: string): string;
Value. Source string.
params. Array of objects used to insert text equivalents of their values to the source string.
DefaultFormat. Default data format.
The Format method replaces each format element in the selected string with a text equivalent of corresponding object value from selected array.
The following objects (parameters) can be used for the IVZBubbleTree bubble tree in the source string: Name (bubble name), SizeTitle (size factor name), SizeValue (size factor value), ColorTitle (color factor name), ColorValue (color factor value), TextTitle (text factor name), TextValue (text factor 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 factor name), SizeValue (size factor value), HeightTitle (height factor name), HeightValue (height factor value), ColorTitle (colorfactor name), ColorValue (color factor value), TextTitle (text factor name), TextValue (text factor value), ChildsCount (number of bubble's children).
Executing the example requires 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}", 2011, 15258.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:
Name of the region with identifier 17 and its value by the color scale.
Percentage equivalent of number 0,425, exponential format of number 2011 and number 15258,2 in the form of record with two decimal digits.
Two phone numbers in a user-friendly format.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Visualizators;
…
Public Shared Sub Main(StartParameters: StartParams);
Var
Metabase: IMetabase;
Analyzer: IEaxAnalyzer;
BubbleTree: IVZBubbleTree;
Formatter: IVZBaseFormatter;
Format: String;
Params: IVZDataArray;
Begin
// Get repository
Metabase := StartParameters.Metabase;
// 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");
System.Diagnostics.Debug.WriteLine(Format);
// Get percentage equivalent of the number 0.42
Format := Formatter.FormatByParam("{0}", 0.425, "0.00%");
System.Diagnostics.Debug.WriteLine("Number 0.42, expressed in percent format: " + 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}", 2011, 15258.2, "0.00");
System.Diagnostics.Debug.WriteLine(Format);
// Get records of two phone numbers in a user-friendly format
Params := New VZDataArray();
Params.Add(89209242536);
Params.Add(84922444090);
Format := Formatter.Format("Contact phones: {0}; {1:#(####)##-##-##}", Params As VZDataArray, "#-###-###-##-##");
System.Diagnostics.Debug.WriteLine(Format);
End Sub;
See also: