Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

  • 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
share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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