select and objectinfo

981 views
Skip to first unread message

Jamie

unread,
Aug 20, 2009, 1:45:26 PM8/20/09
to mapi...@googlegroups.com

Group,

Is there any reason why select * from tablename where objectinfo(obj,21)>1 into t1 gives a datatype mismatch in expression error?

Thanks,

Jamie

brigette

unread,
Aug 20, 2009, 10:39:28 PM8/20/09
to MapInfo-L
Hi Jamie,
what is it you are trying to select?

The objectinfo command tells you what objects are in your table.
The following command would be used to determine object type:

select objectinfo(obj,1) from table

To select an object you would have to specify type of object you would
like selected, ie:
if you would like to select only polygon objects then use this
command,

select * from table where str$(obj)="region"

Hope this helps.
Brigette

Peter Horsbøll Møller

unread,
Aug 21, 2009, 10:46:36 AM8/21/09
to mapi...@googlegroups.com
Jamie,
 
ObjectInfo() can return a number of different types: text, numbers, styles etc.
So in order to make MapInfo aware of what type of value it should compare to one, you need to cast the returned value to a numerical value.
 
This statement should do the trick:
select * from tablename where Val(Str$(objectinfo(obj,21))) > 1 into t1
Note the Val(Str$( .. )) that I have added.
First I case the return value to text and then this is cast to a numeric value.
 
Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo
 
2009/8/20 Jamie <jco...@gmail.com>

Chi7d

unread,
Sep 24, 2009, 2:27:50 AM9/24/09
to MapInfo-L
just stumbled upon this. looks interesting!

how do i select different color objects ? i have browsed the internet
but i just can't get the right rgb code or something. the way i do it
now is a lil bit clumsy. i have a 'id' column with numbers from 0 to 9
(1 for red, 2 for pink ...) and then use this to select objects but if
someone brings their tables i'm all messed up.
the thing i need is the RGB code and how to select symbols according
to RGB.

moreover, is there any way i select symbols within a layer that where
created, let's say from '11.09.2009' onwards ? still, is there a way i
find out a symbols 'creation date' ? why ? because i know that
starting 11.09.2009 for instance i started working on a different
area ... and would like to querry all that area's symbols.

regards!





On 21 aug., 17:46, Peter Horsbøll Møller <mapinf...@horsboll-
moller.dk> wrote:
> Jamie,
>
> ObjectInfo() can return a number of different types: text, numbers, styles
> etc.
> So in order to make MapInfo aware of what type of value it should compare to
> one, you need to cast the returned value to a numerical value.
>
> This statement should do the trick:
> select * from tablename where Val(Str$(objectinfo(obj,21))) > 1 into t1
> Note the Val(Str$( .. )) that I have added.
> First I case the return value to text and then this is cast to a numeric
> value.
>
> Peter Horsbøll Møller
> Pitney Bowes Business Insight - MapInfo
>
> 2009/8/20 Jamie <jcor...@gmail.com>

Driver, Greg 9434

unread,
Sep 24, 2009, 4:47:33 AM9/24/09
to mapi...@googlegroups.com
You could use StyleList tool - http://www.directionsmag.com/files/index.php/view/148

"The STYLIST utility lets you select map objects by their display styles. Select one map object, for example a thick red line. Stylist displays a dialog box, which lets you perform a query by display style. You can select all thick red lines; or you can select all thick lines; or all red lines, etc., by checking or un-checking options in the dialog."

Alternatively, you could use StyleAttr in an SQL select, but you need to know the RGB colour values:

Select * from tablename where StyleAttr (ObjectInfo (obj, 2), 2) = 255 into selection

Will select all symbols coloured blue (255). If the colour code is something like 16,776,960 (yellow) then you can just do:

Select * from tablename where StyleAttr (ObjectInfo (obj, 2), 2) = 16776960 into selection

If you wanted to return all of the unique colour values for objects in a table then you can use:

Select StyleAttr (ObjectInfo (obj, 2), 2) from tablename group by 1 into selection


As for your second question, unless you recorded a 'timestamp' when you created or edited an object in the table, then I don't think this is possible.

HTH

Greg Driver

System Administrator
Applications Support
ICT
Surrey Police
NOT PROTECTIVELY MARKED
Information about this E-mail
This email and any files or attachments with it are intended solely for the use of the individual(s) or organisation(s) to whom it is addressed.
It may contain information that is confidential or subject to legal and/or professional privilege.
If you have received this email in error please notify the sender and delete it including any files or attachments from your e-mail account or computer.
Any opinions expressed in this email are those of the individual and not necessarily those of Surrey Police.
Surrey Police monitor incoming and outgoing e-mail.

kompas

unread,
Sep 24, 2009, 6:33:21 AM9/24/09
to MapInfo-L
Hi Jamie,

I suppose you use MI 9.5.1 or 10, right?
I've had other error message "ObiectInfo: argument 2 out of range"
when launching the same query in these versions. In my case it also
showed that MI 9.5.1+ changed some object types during combine
operation that didn't happen in earlier versions. Unfortunately I
didn't get the answer for that from tech support.
Reply all
Reply to author
Forward
0 new messages