COPY FIELDS TO with variable

COPY FIELDS TO with variable

Postby Marc Vanzegbroeck » Fri Jan 29, 2021 1:58 pm

Hi,

If I do
Code: Select all  Expand view
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: Select all  Expand view
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: Select all  Expand view
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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: COPY FIELDS TO with variable

Postby karinha » Fri Jan 29, 2021 2:33 pm

Code: Select all  Expand view


       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
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: COPY FIELDS TO with variable

Postby Marc Vanzegbroeck » Fri Jan 29, 2021 3: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: Select all  Expand view
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
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium



Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests