TABLE.EXTERNAL_FIELD_NAME_GET Function
Syntax
Arguments
- tablename
The table that contains the fields you wish to retrieve information about.
- format
A character, numeric, logical, or date data display format. Options are:
- "n" = field name
- "N" = uppercased field name
- "t" = simple field type
- "T" = full field type
- "W" = field width
- "D" = field decimal
- "R" = field rule (INCREMENT/CALCULATED=<expression>)
- "L" = Label, the field rule's 'descriptive' name for the field if it is defined, or else the field name properly cased with spaces replacing underbars
- "P" = Presentation width, which may be different from the field width. For example, even though date fields take only 8 characters, their default display format adds two separator characters.
Description
Retrieve external tables field names (and other optional info) in a cr-lf separated list.
Discussion
The TABLE.EXTERNAL_FIELD_NAME_GET() method creates a CR-LF delimited string with information about the fields in Table_Name. Table_Name does not have to be open. This function is useful for populating an array with information about the fields in a table.
Example
The following script populates an array with information about the fields in a table.
dim field_data[100] as P Format = "n|T|W|D" String = table.external_field_name_get("customer",format) Array_format = "fieldname|fieldtype|width|decimals" field_data.initialize_properties(array_format,string) ? field_data[1].fieldname -> "Customer_Id"
To retrieve a list of field names to put in a list box, you might use something like the following code. This approach also gives you a blank (no selection) entry.
dim flist as C flist = crlf()+ table.external_field_name_get("customer","n")
Using the L format to get the field labels:
? table.external_field_name_get("customer","l") = Customer Id First Name Last Name Company Phone Number Fax Number Bill Address 1 Bill Address 2 Bill City Bill State/Region Bill Postal Code Bill Country
See Also