Description
Converts data from the internal system storage format to the specified format. OConv() is identical to Fmt().
Note: In addition to the standard output conversions documented in this chapter, customized input conversions can also be written. See User-Defined Conversions.
Syntax
output = OConv (string, conversion)
Parameters
The OConv function has the following parameters.
Parameter | Description |
---|---|
String | The value of string is the data to be converted to output format. The string can be a dynamic array that contains field marks (ASCII character 254), value marks (ASCII character 253), subvalue marks (ASCII character 252), or text marks (ASCII character 251) as delimiters. All values between these delimiters will be converted as specified, and the delimiters will remain in place. |
Conversion | Identifies the type of data conversion that you want to perform on the string. If conversion is a literal value, you must put it in quotation marks. If conversion is a variable, do not enclose it in quotation marks. Format specifications used in Fmt may be used as conversions. |
After executing an OConv conversion, you can determine the success of the conversion by checking the value of Status(). Possible values of Status() are listed in the following table.
Status() | Meaning |
---|---|
0 | Successful conversion. |
1 | The data in string cannot be converted using conversion. |
2 | Conversion is not a recognized conversion specification. |
3 | Special value that allows a user supplied conversion to suppress system error messages. |
See also
OConv Boolean (B), OConv Date(D), OConv DateTime (DT), OConv Masked Decimal (MD), OConv Masked Scientific (MS), OConv MX, HEX, MO, MB; OConv Time (MT), OConv Variable Binary (VB), OConv Masked Character (MCx), OConv ENCRYPT_FORMAT
Example
/* Converts today's internal date to output in the format MM-DD-YY and assigns the output to the variable "today". */ today = OConv(Date(), "D2-") * Displays $1000.00. Display = OConv(100000, "MD2$")