table.FIELD_GET Function
Syntax
as P = Field_Get([C field_number|N Field_index])
as P = Field_Get([C Fieldname|N Field_index])
Arguments
- field_number
The number of a field in the record. The first field is number 1.
- Fieldname|N
The name of a field in the table.
Description
Get a field given a name or index into current Table.
Discussion
The <TBL>.FIELD_GET() method returns the <FIELD> object pointer that references a particular field from the table referenced by <TBL>. You can specify the field either by number or by name. If you know the Field_Name, you can also get an object pointer to the field by returning the value of the field object's this property. For Example
<FIELD> = <TBL>.Field_Name.this
Contrast the TABLE.FIELD_GET() method for the built-in TABLE object with the <TBL>.FIELD_GET() method for a table object pointer established using the TABLE.OPEN() or TABLE.RESET() methods.
Example
This script fills an array with the field names in a table.
dim fnames[1024] as C ' square brackets required in version 6 and above table_name = ui_get_file("Choose Table","Tables(*.DBF)","","X") if table_name = "" then end end if tbl = table.open(table_name) for i = 1 TO tbl.fields_get() fld = tbl.field_get(i) fnames[i] = fld.name_get()' square brackets required in version 6 and above next i field_choice = ui_get_list_array("Field Names",1,"fnames") tbl.close()
See Also