3

I have mapbasic code that manipulates the obj-column in a point-table. Some rows doesn't have any geometry so the obj-column is empty. My question is how to check if there is no object?

All the methods i found in the mapbasic-reference that givs information about the obj-column, like ObjectInfo(), try to access the object which givs an error since there is none.

Is there any way to use SQL to select the rows with non empty obj-columns?

Regards

6
  • Query For Selecting row(s) without object :
    Select * from 'MYTABLE' where not obj into MYTABLE_NO_MAP_OBJECT   
    Browse * From MYTABLE_NO_MAP_OBJECT
  • Query For Selecting row(s) with object :
     Select * from MYTABLE where obj into MYTABLE_MAP_OBJECT
     Browse * From MYTABLE_MAP_OBJECT
0

Alternative if you loop a table in MapBasic code:

dim a as alias
dim o as object
dim t as string

t = "MyTable"
a = t + ".obj"

fetch first from t
do while not EOT (t)
  if a then 
    o = a
    ' Do something with o
  end if
  fetch next from t
loop
0

use this query in MapInfo SQL , and you will get the result

enter image description here

  • 1- That's very old question.2- Your answer is very short. – BBG_GIS Nov 20 '17 at 11:22
  • simple and short – pranat kirankumar Nov 20 '17 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.