Formatters allow expression values to be transformed. For example, the truncate formatter can be used to shorten the output of an expression. By changing [[ds:/table/record/field]] to [[ds:/table/record/field:truncate 3]] would restrict the output to the first three characters.
The complete list of supported Formatters follows.
Name | Example | Description / Platform(s) |
---|---|---|
Capitalize | [[ds:/table/record/field:capitalize]] | The first letter of the input value is converted to an uppercase letter; the remaining characters are converted to lowercase. Platforms: Android, iOS, Web |
CSS Block Show/Hide | [[ds:/table/record/field:cssblock]] | Returns the value "block" when the argument is non-blank, otherwise the value "none". This is useful with the display attribute of CSS for hiding or showing content. Platforms: Android, iOS, Web |
CSS Inline Show/Hide | [[ds:/table/record/field:cssinline]] | Returns the value "inline" when the argument is non-blank, otherwise the value "none". This is useful with the display attribute of CSS for hiding or showing content. Platforms: Android, iOS, Web |
First Character | [[ds:/table/record/field:first]] | The first character of the input value is returned. Platforms: Android, iOS, Web |
Format Date & Time | [[ds:/table/record/field:formatDate M/d/yyyy/'time'/h/mm/a]] | The input value is interpreted as a Unix Epoch Time and formatted according to the input value. For detailed help, see our support center article and the definitive guide to Date Format Patterns Platforms: Android, iOS, Web |
Format Interval Since Date | [[ds:/table/record/field:formatIntervalSinceDate M/d/yyyy/'time'/h/mm/a]] | This formatter takes a Date Format string as an argument (see our support center article on formatting dates and the definitive guide to Date Format Patterns). The input value is interpreted as a date that follows the Date Format string from the argument. The expression returns a human-readable interval from a date in the past to the current date, such "30 seconds" or "6 days". Platforms: Android, iOS |
Format Interval Until Date | [[ds:/table/record/field:formatIntervalUntilDate M/d/yyyy/'time'/h/mm/a]] | This formatter takes a Date Format string as an argument (see our support center article on formatting dates and the definitive guide to Date Format Patterns). The input value is interpreted as a date that follows the Date Format string from the argument. The expression returns a human-readable interval from the current date to a date in the future, such "30 seconds" or "6 days". Platforms: Android, iOS |
HTML Escape | [[ds:/table/record/field:html]] | Restricted characters in the input value are replaced with HTML entity references. Platforms: Android, iOS, Web |
If Empty | [[ds:/table/record/field:ifEmpty value_if_empty]] | If the input value is empty, the expression will return its argument. If the input value is not empty, the expression will return the input value. Platforms: Android, iOS, Web |
If Equal (String) | [[ds:/table/record/field:ifEqualString compare_to,true_value,false_value]] | This formatter takes 3 arguments, separated by commas. If the first argument is the same as the input value, the expression will return the second argument. If the first argument is not the same as the input value, the expression will return the third argument. Note: All arguments may contain spaces. All commas are treated as delimiters (there can't be a comma in any of the arguments). Platforms: Android, iOS, Web |
If Equal (Variable) | [[ds:/table/record/field:ifEqualVar variable_name,true_value,false_value]] | This formatter takes 3 arguments, separated by commas. The first argument is the name of a variable. If the variable is the same as the input value, the expression will return the second argument. If the variable is not the same as the input value, the expression will return the third argument. Note: All arguments except the first may contain spaces. All commas are treated as delimiters (there can't be a comma in any of the arguments). Platforms: Android, iOS, Web |
If Not Empty | [[ds:/table/record/field:ifNotEmpty value_if_not_empty]] | If the input value is not empty, the expression will return its argument. If the input value is empty, the expression will return the input value, which will be an empty string. Platforms: Android, iOS, Web |
Invert | [[ds:/table/record/field:invert]] | Gives the logical opposite of the input value. For example, if the input value is "yes" the expression will be "no". The full list of supported logical value pairs is: "yes"/"no", "0"/"1", "true"/"false". If the input value is not a recognized logical value, the expression will be "false" Platforms: Android, iOS |
Last Character | [[ds:/table/record/field:last]] | The last character of the input value is returned. Platforms: Android, iOS, Web |
Left | [[ds:/table/record/field:left 20]] | The first N characters of the input value are returned, where N is the numeric argument. Similar to right:. Platforms: Android, iOS, Web |
Lowercase | [[ds:/table/record/field:lower]] | The input value is converted to lowercase letters. Non-letter values remain unchanged. Platforms: Android, iOS, Web |
Math: Add | [[ds:/table/record/field:add 15]] | If the argument is a numeric string, it is added to the input value. If the argument is the name of a variable, the contents of the variable is interpeted as a number and added to the input value. Platforms: Android, iOS, Web |
Math: Divide | [[ds:/table/record/field:div 4]] | If the argument is a numeric string, the input value is divided by argument. If the argument is the name of a variable, input value is divided by the contents of the variable which is interpreted to be a number. Platforms: Android, iOS, Web |
Math: Multiply | [[ds:/table/record/field:mul 10]] | If the argument is a numeric string, it is multipled by the input value. If the argument is the name of a variable, the contents of the variable is interpeted as a number and multipled by the input value. Platforms: Android, iOS, Web |
Math: Subtract | [[ds:/table/record/field:sub 20]] | If the argument is a numeric string, argument is subtracted from the input value. If the argument is the name of a variable, its value is interpreted as a number and subtracted from input value. Platforms: Android, iOS, Web |
Modulo | [[ds:/table/record/field:mod 5]] | If the argument is a numeric string, Modulo gives the remainder of the input value divided by the parameter. If the argument is the name of a variable, its value is interpreted as a number and the remainder of the input value divided by the variable is returned. For example, if [[ds:table/record/field]] has a value of 14, then [[ds:table/record/field:mod 5]] would give a value of 4, since 14 ÷ 5 = 2 remainder 4. Platforms: Android, iOS, Web |
Parse Date | [[ds:/table/record/field:parseDate yyyy-MM-dd'T'HH::mm::ssZZ]] | A string input value is parsed according to the format string given in the argument and converted to a Unix Epoch Time. For detailed help, see our support center article and the definitive guide to Date Format Patterns. In the example shown the format string would parse a date that looks like "2014-08-15T13:45:00-08:00". Platforms: Android, iOS, Web |
Remove Last Character | [[ds:/table/record/field:removeLastChar]] | Returns the input value with the last character removed. Can be used to create a backspace button. Platforms: Android, iOS |
Replace | [[ds:/table/record/field:replace searchString,replaceString]] | The formatter takes 2 arguments separated by a comma: a search string, and a replacement string. Each time the search string appears in the input value, it will be replaced with the replacement string. If you need a comma to be included in your search string or your replacement string, put a "#" before the comma (e.g., [[ds:table/record/field:replace hello#, world, goodbye#, world]] will replace "hello, world" with "goodbye, world"). Note that the search is case-sensitive, i.e., if your input value is "Hello" and your search string is "hello", there will be no replacement. Platforms: Android, iOS |
Right | [[ds:/table/record/field:right 20]] | The last N characters of the input value are returned, where N is the numeric argument. Similar to left:. Platforms: Android, iOS, Web |
Sign | [[ds:/table/record/field:sign]] | If the input value is numeric, this formatter gives the sign (+, - or 0) of the input value. If the input value is not numeric, this formatter will return 0. Platforms: Android, iOS |
Strip All HTML | [[ds:/table/record/field:stripHtml]] | All HTML markup e.g., tags and entity references, is removed from the input value. Platforms: Android, iOS, Web |
Strip HTML Links | [[ds:/table/record/field:nolinks]] | All HTML links are removed from the input value, but other HTML markup is preserved. Platforms: Android, iOS, Web |
Truncate | [[ds:/table/record/field:truncate 60]] | The input value is truncated to the numeric value specified by the argument and an ellipsis (…) is added to the truncated value. Platforms: Android, iOS, Web |
Uppercase | [[ds:/table/record/field:upper]] | The input value is converted to lowercase letters. Non-letter values remain unchanged. Platforms: Android, iOS, Web |
URL Escape | [[ds:/table/record/field:url]] | The input value is URL encoded (replacing restricted characters by allowed representations). The resulting value may then be used as part of a URL. Platforms: Android, iOS, Web |