I'm trying to create a MapBasic tool which will automatically merge polygons when a line is drawn over the polygons I wish to merge. But I get an error 'Unrecognized command: Where' Here is my code. Can anyone see where I am going wrong please?
' Set the input and output table names
Dim inputTable As String
Dim outputTable As String
inputTable = "Input_Table"
outputTable = "Output_Table"
' Set the name of the line table
Dim lineTable As String
lineTable = "Line_Table"
' Create a new temporary table to hold the selected polygons
Dim tempTable As String
tempTable = "Temp_Table"
Create Table tempTable (Obj Integer, ID Integer)
' Select polygons that intersect the line
Insert Into tempTable (Obj, ID) Select * From inputTable Where Obj Intersects Any lineTable
' Merge the selected polygons into a single feature
Dim newObject As Object
Select * From tempTable Into newObject
Commit Table newObject As outputTable
' Clean up the temporary table
Drop Table tempTable