| Subject |
Re: modify table structure in program |
| From |
Charlie <tm@tc.com> |
| Date |
Sun, 06 Mar 2022 07:30:03 -0500 |
| Newsgroups |
dbase.getting-started |
Hi Ken, Mervyn,
Thanks so much.
I woke up with a brainstorm this morning! A solution I think I can handle. Make the 'save as' table temporary then append or replace these new fields into a permanent table that may or may not have data. I believe this is possible and probably easier for me. Hopefully so.
If I decide I need to go another way I'll attach the data to a future message. Thanks again!
Mervyn Bick Wrote:
> On 2022/03/06 00:15, Charlie wrote:
> > Hi... I am importing a csv file by 'save as' a dbase table. But I only have four fields in the csv file and I need to modify the table before opening the form with grid which specifies more fields. As I understand 'save as' overwrites the table losing all structure. Wondering if there is a way to add and modify fields using a program rather than manually modifying the structure?
> >
> > Thanks for any help.
>
> As Ken has pointed out the localSQL command ALTER TABLE, which can be
> used in a little program, will add (or drop) fields from a table.
> Details are in the dBASE help file. This will, however only add fields
> after the existing fields in each record. If you need the extra fields
> interspersed between the four fields from the .csv file it can be done
> but it needs an additional step using the SAVE TO option of the SELECT
> command.
>
> The 'save as' suggests you are reading the .csv file into a spreadsheet
> (perhaps Excel) and then saving to a .dbf file. This is all very well
> for dealing with an occasional .csv file. If, on the other hand, you
> have to deal regularly with similar data in a .csv file it is far more
> productive to write a simple little program to import the .csv directly
> into a .dbf file.
>
> If you post the structure of the .dbf file your grid needs and show
> which fields need the data from the .csv file I can give you a little
> example program.
>
> It will help if you can also provide a .csv file with, say, 5 records.
> If the information is confidential then give details of how dates,
> timestamps or logical values (if any) are presented in the .csv file.
>
> Would you want to create a separate .dbf for each .csv file or would you
> want to append each .csv file to an existing .dbf file?
>
> Mervyn.
>
>
>
>
>
>
|
|