TABLE_RESTRUCTURE Function

Syntax

TABLE_RESTRUCTURE( Field_List as C )

Arguments

Field_List

CR-LF delimited list of field specifications in the format: Field_Name [ = Original_Name ], Type [ + ], Width, Dec [ = Expression ]

Field_Name

The new name of the field to restructure.

Original_Name

Optional. Default = Field_Name. The original name of the field to restructure. You need to specify this if you are renaming the field. "" = delete the existing field named Field_Name and create a new one.

Type

The data type of the field. Adding a "+" after the field type will define the field as an auto-increment field.

Width

Optional. The width of the field in characters. Required only for character and numeric fields.

Dec

Optional. The number of decimal characters. Required only for numeric fields.

Expression

Optional. Defines the expression to use and creates a calculated field that will not appear in the table structure.

Description

The TABLE_RESTRUCTURE() function takes a CR-LF delimited list of field specifications in the format [=],,, and restructures a table.

Example

The following example modifies the Cust2 table.

dim c2 as P
c2 = table.open("cust2",FILE_RW_EXCLUSIVE)
c2.table_restructure(<<%str%
CUSTOMER_ID,Character,8,0
FIRSTNAME,Character,25,0
LASTNAME,Character,25,0
COMPANY,Character,32,0
PN=PHONE,Character,20,0
FAX,Character,20,0
BILL_ADDRESS_1,Character,40,0
BILL_ADDRESS_2,Character,40,0
BILL_CITY,Character,20,0
BILL_STATE_REGION,Character,20,0
BILL_POSTAL_CODE,Character,10,0
BILL_COUNTRY,Character,20,0
SHIP_ADDRESS_1,Character,40,0
SHIP_ADDRESS_2,Character,40,0
SHIP_CITY,Character,20,0
SHIP_STATE_REGION,Character,20,0
SHIP_POSTAL_CODE,Character,10,0
SHIP_COUNTRY,Character,20,0
SHIP_SAME,Logical,1,0
EMAIL,Character,60,0
NOTE,RTF
%str%)
c2.close()

Limitations

Desktop applications only.

See Also