Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A user-defined conversion is a BASIC+ subroutine that contains the logic necessary to convert data into and out of a format required for an application. For example, you might want to create an output conversion which converts telephone numbers (entered with digits) into formatted telephone numbers (placing parentheses around area codes and a hyphen between the first 3 digits and the last 4 digits). In fact, OpenInsight includes the source code for PHONE_FORMAT (to be discussed later in this chapter), that does this.

User defined conversions have great versatility. They can be used in a variety of situations. Examples discussed in this section,with source code included, are:

  • PHONE_FORMAT (described above)

  • NUMTOCHAR_CONV, forcing numbers (such as 1, 1.0, and 1.00) that compare as equal to each other if compared numerically, to be compared as strings (such as in a product code, where they might refer to different products).

  • UPPER_CASE, converting the case to upper case, mixed case, or proper case. This conversion can also be used to convert to upper case characters in window controls, such as an edit table, where the check box for upper case conversion does not exist.

  • ZIP_FORMAT, validating and converting a zip code to the 5- or 9- digit format for US zip codes, and for Canadian Postal Codes as well.