Tom
 
There isn't really an equivalent to cut/copy & paste, but there is the concept of read & write:
 
I assume you already have each record, in the 2 tables current, i.e. you have moved to them by some means (say in a browse)
In the button code for the "copy" function, using global variables:
 
gcPnoneNo  = NewTable.PhoneNo
gcCustNo   = NewTable.CustNo
gcCustName = NewTable.CustName
... etc.
 
In the button code for the "paste" function:
 
lnRowId = OldTable.RowId
Update oldTable
  Set PhoneNo  = gcPnoneNo,
      CustName = gcCustName,
      ... etc.
  where RowID = lnRowID
 
Now I assume that you do a whole bunch of these in one go.  It doesn't seem right to be edging through each file, manually triggering this update process.  I assume that the "Old" table has records that match those in the "new" table, and so can be sought on some key:
 
Fetch first in NewTable
Do while not EOT( "NewTable")
  gcPnoneNo  = NewTable.PhoneNo
  gcCustNo   = NewTable.CustNo
  gcCustName = NewTable.CustName
  ... etc.
  Select * from OldTable
    where OldTable.CustNo = gcCustNo
  Update selection
    Set PhoneNo  = gcPnoneNo,
      CustNo   = gcCustNo,
      CustName = gcCustName,
      ... etc.
  Fetch next in NewTable
Loop
 
HTH
 
Terry


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Halbrook
Sent: 29 August 2006 15:16
To: Terry McDonnell
Subject: [MI-L] Copy - Paste in MapBasic

I am still learning Map Basic and trying to write a program to copy a record in a row in one table and paste it into a row in another table.

 

Here’s my scenario. Each week I update changes in a telephone customer database. I get a file from my Service Center that has all the moves, disconnects, and adds that have occurred in the previous week. I convert the file into a MapInfo table and update my MapInfo Customer Locator program. 

 

Example: On a number change I presently select the telephone in the new table, hit ctrl C, and then select the telephone number field in the old table and hit ctrl V.

(A lot of repetitive key strokes)

 

The procedure I am striving for would be; 1. Select the record in the first table, click on a pushbutton (to copy the selection) Then 2. Select the record in the second table, click on another pushbutton (to paste the copied record into the second table)

 

I can build the program to create the button pads etc. But I can’t seem to find any MapBasic command that is equivalent to “Copy & Paste”

Can anyone give me the Map Basic Commands or Statements that would be equivalent to “Copy and Paste” action in MapInfo?

 

Thanks, Tom Halbrook

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to