FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour COPY FIELDS TO with variable
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
COPY FIELDS TO with variable
Posted: Fri Jan 29, 2021 01:58 PM
Hi,

If I do
Code (fw): Select all Collapse
copy fields NTWKNUM,NODENUM,MODNUM,SLOTNUM,NAME,PTDESC,KEYWORD,NODETYP,POINT_TYPE TO c:\temp\tpsdoc.dbf

it's working like expected.

Now I want the fields coming from a variable like this
Code (fw): Select all Collapse
vvelden = "NTWKNUM,NODENUM,MODNUM,SLOTNUM,NAME,PTDESC,KEYWORD,NODETYP,POINT_TYPE"
copy fields (vvelden) TO c:\temp\tpsdoc.dbf


It's not doing anything, I also get no error.

I already tried with
Code (fw): Select all Collapse
vvelden = "NTWKNUM,NODENUM,MODNUM,SLOTNUM,NAME,PTDESC,KEYWORD,NODETYP,POINT_TYPE"
copy fields &vvelden TO c:\temp\tpsdoc.dbf


Also without any result.
Is it possible with a variable?
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: COPY FIELDS TO with variable
Posted: Fri Jan 29, 2021 02:33 PM
Code (fw): Select all Collapse
       Formats: COPY TO <file> [<scope>] [FIELDS <list>] [FOR <expL>]
                       [WHILE <expL>] [TYPE <file_type>]
                COPY FILE <file1> TO <file2>
                COPY STRUCTURE TO <file> [FIELDS <list>]
                COPY TO <file> STRUCTURE EXTENDED

       COPY TO copies database records to another file.

       COPY <file> copies any file to another file.

       COPY STRUCTURE copies a database structure to another database.

       COPY TO ... STRUCTURE EXTENDED copies a database structure into
               another database, one record per field.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: COPY FIELDS TO with variable
Posted: Fri Jan 29, 2021 03:49 PM
João,

I know that is the format, but I wanted to store the fields in a variable, because, I want the fields, depending of the content of a database.

That was not working with the command.

I found a solution with __dbCopy

Code (fw): Select all Collapse
vvelden := { "NTWKNUM","NODENUM","MODNUM","SLOTNUM","NAME","PTDESC","KEYWORD","NODETYP","POINT_TYPE" }
 __dbCopy( "c:\temp\tpsdoc1.dbf", vvelden ,,,,, .F., )
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM

Continue the discussion