TABLE.ADD_FIELDS Function
Syntax
Arguments
- tablename
The name of the table.
- new_field_list
A CR-LF delimited string containing the name and definition of each new field to be added. Each field in Field_List is specified in the format: Fieldname, type, width, decimal_places. The field types, the single character codes used to represent them, and the valid parameters associated with them are:
- Field Type
- Type Code and Valid Parameters
- Character
"C", Fieldname, Field Type, Width
- Numeric
"N", Fieldname, Field Type, Width , Decimal Width
- Date
"D", Fieldname, Field Type
- Logical
"L", Fieldname, Field Type
- Memo
"M", Fieldname, Field Type
- Rich text memo
"R", Fieldname, Field Type
- Bitmap
"B", Fieldname, Field Type
- OLE
"O", Fieldname, Field Type
- Linked image
"I", Fieldname, Field Type
Description
Adds fields to a table. New_fields is a crlf list of fields to be added in format: fieldname,type,size,decimals
Discussion
The TABLE.ADD_FIELDS() method adds new fields to an existing table. If Field_List contains a field name that is not unique, then the field name is adjusted so that it is unique. E.g. "name" becomes "name1" etc. All of the existing data in Table_Name is preserved when the new fields are added.
This script adds several new fields to an existing table.
fields = <<%str% Product,c,20 Price,n,10,2 Notes,m %str% table.add_fields("table1", fields)
See Also