View this page in the latest version of Appian. text() Function Share Share via LinkedIn Reddit Email Copy Link Print On This Page Function text( value, format ) The text() function allows you to format Number, Date, Time, or Date and time values as you convert them into text strings. Parameters Keyword Type Description value Number/Date/Time/Datetime The value to convert to a text string. format Text The output format string, supporting "date/time" format, "positive" format, "positive;negative" format or "positive;negative;zero" format. Returns Text Usage considerations Using the format parameter The format "date/time" can only be for the positive. When you specify a numeric text format for a decimal number, such as "$000.00" or "$###.##", any values that go beyond the number of decimal places in your format pattern are dropped, without rounding. For all formats, the returned value is determined by the current locale setting (either the user's locale or the system-wide locale overriding user settings). If users specify different locales, they may see different values when executing a rule, viewing an interface, or running a process model where the text function is used. See Examples for a comprehensive list of the available formats. Using the value parameter Beans are not supported in the value parameter. Examples text(10.25, "$00.0000") returns the $10.2500 Possible text() function date/time formats The text(value,"format") function allows you to format the text output in various ways. You can also combine values, formats, and characters to structure your text, such as mmmm/dd/yyyy. The following table describes available date, time, and datetime formats you can specify. These formats and their outputs are derived from ICU4J, an industry-standard globalization library. Note: The example results shown in the Returns column are en_US locale values and may not match the output in your application or the current Unicode CLDR data. Format Output Example (12:15 PM on February 27, 2020 ) Returns mmmmm The first letter of the month text(date(2020, 2, 27),"mmmmm") F mmmm Full name of the month text(date(2020, 2, 27),"mmmm") February mmm Three-letter abbreviation for the month text(date(2020, 2, 27),"mmm") Feb mm Month as a two-digit number text(date(2020, 2, 27),"mm") 02 m Month as a one-digit number, with no leading zero text(date(2020, 2, 27),"m") 2 yyyy Full four-digit year text(date(2020, 2, 27),"yyyy") 2020 yy Last two digits of the year text(date(2020, 2, 27),"yy") 20 ddd The date of the month with a suffix text(date(2020, 5, 27),"ddd") 27th dd The date of the month as a two-digit number text(date(2020, 2, 27),"dd") 27 d The date of the month as a one or two-digit number, with no leading zero text(date(2020, 2, 27),"d") 27 hh Hour in 12-hour time, with a leading zero for single-digit hours text(datetime(2020, 2, 27,12,15,05),"hh") 12 h Hour in 12-hour time, with no leading zero text(datetime(2020, 2, 27,12,15,05)),"h") 12 kk Hour in 24-hour time, with a leading zero for single-digit hours text(datetime(2020, 2, 27,12,15,05),"kk") 12 k Hour in 24-hour time, with no leading zero text(datetime(2020, 2, 27,12,15,05),"k") 12 mm Minute as a two-digit number (If hour already processed, i.e., h to left anywhere in format) text(datetime(2020, 2, 27, 12, 15, 05),"h:mm") 12:15 ss Second as a two-digit number, text(datetime(2020, 2, 27, 12, 15, 05),"ss") 05 AM/PM AM/PM in uppercase text(datetime(2020, 2, 27, 12, 15),"AM/PM") PM am/pm am/pm in lowercase text(datetime(2020, 2, 27, 12, 15),"am/pm") pm A/P A/P in uppercase text(datetime(2020, 2, 27, 12, 15),"A/P") P a/p a/p in lowercase text(datetime(2020, 2, 27, 12, 15),"a/p") p a AM or PM in uppercase text(datetime(2020, 2, 27, 12, 15),"a") PM aa AM or PM in uppercase text(datetime(2020, 2, 27, 12, 15),"aa") PM [h] The number of hours in the era text(datetime(2020, 2, 27, 12, 15, 05),"[h]") -130116 @ The serial date value text(datetime(2020, 2, 27, 12, 15, 05),"@") -5421.49 dddd Full weekday name text(date(2020, 2, 27),"dddd") Thursday EEEE Full weekday name text(date(2020, 2, 27),"EEEE") Thursday EEE Three-letter weekday abbreviation text(date(2020, 2, 27),"EEE") Thu z Timezone Name short form text(datetime(2020, 2, 27, 12, 15, 05),"z") GMT+00:00 zzzz Timezone Name long form text(datetime(2020, 2, 27, 12, 15, 05),"zzzz") GMT+00:00 Note: The formats that return the name, number, or first letter of a month are not case sensitive. The formats that return AM or PM are case sensitive and will return AM, PM, A, or P in the case that you specify. Possible number formats for text() function output If the format you use contains the number sign (#) zero (0) or a question mark (?), then the output takes a number format. The output is then treated as a number rather than as a date/time. You can split the number format into positive;negative;zero;text formats (where each optional format is separated by a semi-colon [;]). Normally, positive numbers do not show a sign symbol. To use plus (+) or minus (-) symbols, specify the positive and negative number-formats separately (as in the following examples). text(-3.434,"+0000.###;-0000.###")returns -0003.434 text(3.434,"+0000.###;-0000.###") returns +0003.434 The following table lists the characters that can be used to the left of any decimal for defining a number format. Format Meaning Example Returns 0 Numeric digit or leading 0 text(1234.5, "00000.00") 01234.50 # Numeric digit or leading space text(1234.5, "#####.##") 1234.50 , Grouping seperator text(1234.5, "##,###.##") 1,234.50 . Decimal point. Switches to right of decimal formatting text(1234.5, "#####.##") 1234.50 - Always "-" text(1234.5, "-#####.##") -1234.50 + "+" if positive, "-" if negative text(1234.5, "+#####.##") +1234.50 c The character c text(15, "#c") 15c $ The currency character text(1234.5, "$####.##") $1234.50 % Any % multiplies the number by 100 text(0.50, "#%") 50% Any other character Represented as itself text(1234, "## & ##") 12 & 34 The following table lists the characters that can be used to the right of any decimal for defining a number format. Format Meaning 0 Numeric digit or leading 0 # Numeric digit or leading space , Grouping seperator c The character c $ The currency character Any other character Represented as itself Criteria formatting for numbers In these two examples, a positive and a negative number format (with red) are defined for the expression. The negative format and red color are only applied when the value is less than 0. text("-100000", "###,###.##;[<0][red] - ###,###.##") returns <font color="#FF0000"> - 100,000.00</font> text("100000", "###,###.##;[<0][red] - ###,###.##") returns 100,000.00 Note: These examples return colored text in an HTML format. These should only be used to format text in HTML, such as in the body or header of an email created by a send email smart service. Different formats can be applied using the criteria listed in the following table. Format Description Example Returns positive_format;negative_format;zero_format All specified text(0, "$00.00;#00.00;*00.0") *00.0 positive_format;negative_format Zero is same as positive text(-10.25, "$00.00;(00.00)") (10.25) positive_format Negative is "-positive", Zero is positive text(10.25, "$00.00") $10.25 Formats for less than, greater than, or equal to: Format Description [>number]format;… Use when value > number [>=number]format;… Use when value >= number [<number]format;… Use when value < number [<=number]format;… Use when value <= number [=number]format;… Use when value = number [<>number]format;… Use when value <> number Other sample criteria Format Meaning [<=9999999]000-0000;(000) 000-0000 US phone number 000-00-0000 US Social Security Number [<=99999]00000;00000-0000 US Zip or Zip+4 Code Feature compatibility The table below lists this function's compatibility with various features in Appian. Feature Compatibility Note Portals Compatible Offline Mobile Compatible Sync-Time Custom Record Fields Incompatible Real-Time Custom Record Fields Incompatible Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. Process Reports Compatible Process Events Compatible Can be used to configure a process event node, such as a start event or timer event. Process Autoscaling Compatible Can be used in autoscaled processes. Feedback Was this page helpful? SHARE FEEDBACK Loading...