18. Working with Data Types and Data Display Formats : Data Display and Input Formats : How Character Data Is Displayed
 
Share this page                  
How Character Data Is Displayed
Character data includes any of the character data types (varchar, char, c, text). You can display character data types only in:
Character (c) display format (in display‑only and data entry fields)
String template display format (in data entry fields only)
For the character (c) data display format, the default is left justification. To justify the contents of a single‑line field to the right, left, or center, precede the data display symbol with a plus sign (+), asterisk (*), or minus sign (‑), respectively. For example, entering +c5 specifies a right‑justified text field of five or fewer characters. You can use justification symbols with any data type.
If you specify a value for w as well as n, you can display text in column format. When character fields contain more than one line, the first line of the field is filled with characters and the second line is filled. This can produce line breaks in the middle of a word. For display‑only fields, you can use the f or j option to specify that lines must break at the end of a word instead of in the middle. For example, cf80.20 specifies a text field containing a total of 80 characters with no line containing more than 20 characters and with breaks between words.
To right justify the contents of a display‑only multi‑line character field, use the j flag. The j flag performs the same function as the f flag, except that it pads the line with blanks between words to make the right margin of each line come out even, like a column of text in a newspaper.
The f and j flags are most useful in display-only fields. If used in a data entry field, the word wrap or justification operation is performed only after the user has exited the field. This can cause truncated text or other unpredictable results, because a word can wrap to the next line or the line is padded with extra blanks after the user has already exited the field.