David,

Here is a very baseline source for merging multiple tables.
It doesn't check much of a table structures access rights or anything, but will do the 
thing if you are just careful.

If you don't have MapBasic let me know and I'll mail you a compiled version.

Anssi

'*****************************************
Include "mapbasic.def"

Declare Sub Main
Declare Sub Main_chk
Declare Sub AppendTables

Global strAppend(), strTables(), strResult As String

Sub Main
 Dim i, iResult As Integer


 For i = 1 To NumTables()
  ReDim strTables(i)
  strTables(i) = TableInfo(i,TAB_INFO_NAME)
 Next


 Dialog
  Title "Append multiple tables"

  Control MultilistBox ID 10 Title From Variable strTables Width 100 Calling Main_chk

  Control PopupMenu ID 20 Title From Variable strTables Width 100 Into iResult

  Control OKButton ID 1 Calling Main_chk Width 100


 If CommandInfo(CMD_INFO_DLG_OK) Then
  If iResult Then
   Set Event Processing Off
   Set ProgressBars Off
   strResult = strTables(iResult)

   Call AppendTables

   Set Event Processing On
   Set ProgressBars On
   Note "---Success---"
  End If
 End If


End Sub


Sub Main_chk
 Dim i, iDummy As Integer

 Do Case TriggerControl()
  Case 1
   ReDim strAppend(0)
   For i = 1 To NumTables()
    iDummy = ReadControlValue(10)
    If iDummy Then
     ReDim strAppend(i)
     strAppend(i) = strTables(iDummy)
    Else
     Exit For
    End If
   Next
   If Not UBound(strAppend) Then
    Dialog Preserve
   End If
 End Case

End Sub

Sub AppendTables
 Dim i, j As Integer
 Dim colList As String

 Set Table strResult FastEdit On Undo Off

 For i = 1 To UBound(strAppend)
  colList = ""
  For j = 1 To Minimum(NumCols(strAppend(i)),NumCols(strResult))
   colList = colList & ", COL" & j
  Next

  colList = Right$(colList,Len(colList)-2)

  Run Command "Insert Into " & strResult & " (" & colList & ") Select " & colList & " 
From " &strAppend(i)
 Next

 Commit Table strResult

End Sub

'*****************************************

----- Original Message ----- 
From: David Thibault <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 11, 2000 10:43 PM
Subject: MI Tool for merging several tables


> Hi all!
> 
> Does anyone know where i could find a mapbasic program for merging several 
> tables automatically without using the usual slow method, i.e. the Append to 
> table command.
> 
> Thanks in advance
> 
> David
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> 
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to