{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}

ToText

Converts values of different data types into a string representation of the value.

Usage:

ToText( x )
ToText( x, y )
ToText( x, y, z )
ToText( x, y, z, w )
ToText( x, y, z, w, q )

Parameters:

Converting a Boolean

x A Boolean value that is converted to a string (either "true" or "false").

Converting a Number or Currency

x A number or currency value to be converted (can be a whole number or a decimal number).
y A number specifying how many decimal places of x to include in the string [OPTIONAL, default is 2].
z The character to separate thousands with [OPTIONAL, default depends on your locale].
w The character to use for the decimal point [OPTIONAL, default depends on your local].

Converting a Number or Currency With Formatting Options

x A number or currency value to be converted (can be a whole number or a decimal number).
y The text string specifying how to format the string representation (see formatting patterns).
z How many decimal places of x to include in the string [OPTIONAL, default is zero].
w The character to use for the thousands separator [OPTIONAL, default depends on your locale].
q The character to use for the decimal point [OPTIONAL, default depends on your locale].

Converting a Number, Date, Time or DateTime using the system default formats

x A number or date/time value to be converted.
y The default pattern string or constant. (see formatting patterns).

Converting Single Date, Time, or DateTime Values

x a date, time, or datetime to convert to a string.
y the text string specifying how to format the string representation (see formatting patterns) [OPTIONAL, default depends on your locale].
z the text string to use for "A.M." (see formatting patterns) [OPTIONAL, default depends on your locale - only for time and datetime].
w  the text string to use for "P.M." (see formatting patterns) [OPTIONAL, default depends on your locale - only for time and datetime].

Converting ranges

x A range value of any type except binary. This range will be converted into easy-to-read text and will be checked for whether it is a special range, in case it is a date or dateTime range.
The following "special ranges" are detected: * Entire months - if a date range is specifically one month exactly, the function will return "[Month-Name] [Year]", e.g. the date range "3/1/03 to 3/31/03" would return "March 2003". * Quarters - if a date range is specifically a quarter of the year, this function will return "[QuarterNumber]th Quarter, [Year]", e.g. the date range "4/1/06 to 6/30/06" would return "2nd Quarter, 2006". * Calendar weeks - if a date range is precisely a calendar week, this is detected and the function will return "Week [WeekNumber], [Year]". A calendar week is defined by the locale and can start either on Sunday or Monday. See the Excel or OpenOffice function WeekNum, as well as the ISO definition of a calendar week at http://en.wikipedia.org/wiki/ISO_week_date. * Number formatting depends on either the report or server locale settings, if no pattern is set.
y the pattern string specifying how to format the string representation (see formatting patterns). This parameter may contain one pattern or two patterns for both boundaries separated by a ' to '. If two patterns are specified, the lower and upper boundary of the range can be formatted different. [OPTIONAL, default depends on your locale]. This parameter only has an effect on date, time, dateTime and number values.

Returns:

A string

Examples:

The following examples assume you have an English (U.S.) locale - it may look different in your locale:

ToText(99.0)
-> Returns the String '99.00'.
ToText(99.0,0)
-> Returns the string '99'
ToText(13456.567,"#")
-> Returns
the string '13457'
ToText(13456.567,1,"#","*")   	//='13#456*6'
-> Returns
the string '13#456*6'
ToText(true)       	//='true'
-> Returns
the string 'true'
totext(  time( #11:20# )  , systemLong );       	// the locale is 'en_US' for this example
-> Returns
the string '11:20:00 CET'
totext(  0.95  , "percent" );       	// the locale is 'en_US' for this example
-> Returns
the string '95%'
totext( 1 to 5, "0 to 0" );       	// print a simple number range without fraction
-> Returns
the string '1 to 5'
totext( #1/1/2010# to #2/1/2010#, "dd-MM-yyyy to dd MMM yyyy" );       	// print a data range with individual formats
-> Returns
the string '01-01-2010 to 01 Feb 2010'

See also: