Renaming fields

Renaming fields

Post by BBauman » Wed, 30 Jun 1999 04:00:00



Hey everybody!

    I can't thank you people enough! All of you have been so much help to
me. Now please alow me to pick your minds again. ;-)

I need to make the first row of text in my dbf file into the field names...
Currently the field names are F1, F2, F3, F4, F5, ETC....

EX.

First row - Field1 | Field2 | Field3 | Field4 | Field 5 |
Now that is the FIRST ROW AND NOT THE CURRENT FIELD NAMES...But I want to
make them the field names. (The " | " Seperating the "Field#" is just a
marker to show the next field.)

Hope someone understands :-)

Thank you all once again.
Bradley.

 
 
 

Renaming fields

Post by News » Wed, 30 Jun 1999 04:00:00


goto the first record
Construct a loop from 1 to fcount()
replace the field value with field(loopcount)

Al


>Hey everybody!

>    I can't thank you people enough! All of you have been so much help to
>me. Now please alow me to pick your minds again. ;-)

>I need to make the first row of text in my dbf file into the field names...
>Currently the field names are F1, F2, F3, F4, F5, ETC....

>EX.

>First row - Field1 | Field2 | Field3 | Field4 | Field 5 |
>Now that is the FIRST ROW AND NOT THE CURRENT FIELD NAMES...But I want to
>make them the field names. (The " | " Seperating the "Field#" is just a
>marker to show the next field.)

>Hope someone understands :-)

>Thank you all once again.
>Bradley.


 
 
 

Renaming fields

Post by Anders Altber » Wed, 30 Jun 1999 04:00:00


SELECT Table
FOR i = 1 TO FCOUNT()
 GO TOP
 x = ALIAS()
 y = FIELD(i)
 z = EVAL(FIELD(i))
 ALTER TABLE &x RENAME COLUMN &y TO &z
NEXT

All the columns have to be Character so the can hold a name and they mustn't
be empty or contain duplicate names.
-Anders


> Hey everybody!

>     I can't thank you people enough! All of you have been so much help to
> me. Now please alow me to pick your minds again. ;-)

> I need to make the first row of text in my dbf file into the field
names...
> Currently the field names are F1, F2, F3, F4, F5, ETC....

> EX.

> First row - Field1 | Field2 | Field3 | Field4 | Field 5 |
> Now that is the FIRST ROW AND NOT THE CURRENT FIELD NAMES...But I want to
> make them the field names. (The " | " Seperating the "Field#" is just a
> marker to show the next field.)

> Hope someone understands :-)

> Thank you all once again.
> Bradley.