Character String Functions
Functions for character strings are usually used in formatting a report column's contents. Following are some common functions for character strings:
-
Alltrim(cValue) removes trailing and leading spaces from cValue.
-
HyperTarget( cFieldName, cExpr ) creates a direct hyperlink. To be able to see a direct hyperlink (i.e., a hyperlink field on a screen), the syntax is HyperTarget( cFieldName, cExpr ). Example: NAMES->( HyperTarget( "HYPERTEST", "LastFirst()" ) ) This example would likely be for a matters report that wanted last, first fields of a direct connect hyperlinked name.
-
LastFirst(nChars) is a function that returns the current name record's last name field, plus a comma, plus a space and the first name (for example, "Smith, John"). nChars=length of string to return.
-
Padr(cValue, nChars) pads cValue with spaces as needed to be nChars long.
-
StrTran(cSource, cDelete) deletes cDelete from cSource. Example: STRTRAN(names->zip, "- ") formats the ZIP field so if it only has 5 digits the trailing hyphen and following spaces are removed.
-
Trim(cValue) removes trailing spaces from cValue. Trim(cValue) returns the same character string that is passed to it as cValue, but all trailing spaces are trimmed off. So trim("Surber ") will return "Surber" with no trailing spaces. Since fields have fixed sizes, and since a field reference returns the field contents padded with spaces to have the right length, the TRIM function is often used around field references. For example, Names->Last will return "Surber" plus enough spaces to have 30 total characters. To get just the text, you would use Trim(Names->Last).