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

3 Answers 3

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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