Is there a solution to how to deall with a row not having an object attached ???
Of course you can validate this by either only selecting records "where obj", or you could use an alias variable to check whether these is an object at the current row, but can you handle this problem in the "MyFunction" function ? Peter Horsb�ll M�ller GIS Developer Geographical Information & IT COWI A/S Odensevej 95 DK-5260 Odense S. Denmark Tel +45 6311 4900 Direct +45 6311 4908 Mob +45 5156 1045 Fax +45 6311 4949 E-mail [EMAIL PROTECTED] http://www.cowi.dk -----Original Message----- From: Bill Thoen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 01, 2004 9:45 PM To: MapInfo-L Subject: Re: MI-L Set multiple object symbols quickly? Good point. FastEdit and Undo Off will goose it a little more. There's another small modification I forgot that should probably be made too. The Type field by itself is not enough to create the object; it just influences the style. You should include the original object so you can copy the geography parameters to the new object and then tweak the style depending on what you find in Type. Here's how it should look: Set Table MYTABLE FastEdit On Undo Off UPDATE MYTABLE SET obj = MyFunction( obj, Type ) Commit Table MYTABLE Set Table MYTABLE FastEdit Off Undo On Again, do not fail to pass fields from tables by value. The declaration should look something like this: Declare Function MyFunction( ByVal objThing as Object, ByVal sType as String ) As Object - Bill Peter Horsb�ll M�ller wrote: > > And to get really going use this syntax: > > Set Table MYTABLE FastEdit On Undo Off > UPDATE MYTABLE SET obj = MyFunction( Type ) > Commit Table MYTABLE > Set Table MYTABLE FastEdit Off Undo On > > This prevents MapInfo from writing temporary transaction files. > > Peter Horsb�ll M�ller > GIS Developer > Geographical Information & IT > > COWI A/S > Odensevej 95 > DK-5260 Odense S. > Denmark > > Tel +45 6311 4900 > Direct +45 6311 4908 > Mob +45 5156 1045 > Fax +45 6311 4949 > E-mail [EMAIL PROTECTED] > http://www.cowi.dk > > -----Original Message----- > From: Canfield, Andrew [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 01, 2004 6:05 PM > To: 'Bill Thoen' > Cc: MapInfo-L > Subject: RE: MI-L Set multiple object symbols quickly? > > Thanks Bill! That is exactly what I was looking for. > > -----Original Message----- > From: Bill Thoen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 01, 2004 7:33 AM > To: Canfield, Andrew > Cc: MapInfo-L > Subject: Re: MI-L Set multiple object symbols quickly? > > "Canfield, Andrew" wrote: > > > > Is there a quick way to set the symbol for a large selection of > > objects using MapBasic? > > Write a function in MB that returns an object when passed your Type > variable and use it in the UPDATE statement like so: > > UPDATE MyTable SET obj = MyFunction( Type ) > > Note that table columns like 'Type' must be passed ByVal. > > This trick works MUCH faster than a Do Loop! > > > > > Here is my problem: I have a series of tables, in each of > > these tables I have multiple point object groups, they are grouped > > by a field called "type" in my MapBasic I select all from that table > > where the "type" like "x". > > Currently I loop through the selection and set each row's > > object symbol to what I want it to be. This is horrendously slow > > considering > there > > can be 100,000+ objects for each selection I run on the table and > > there > can > > be 15 to 20 different "type"'s within the table. > > So I'm wondering if there is a MapBasic statement where I > > could do something along the lines of "Set Symbol = > > MakeSymbol(1,1,255) Where > (Select > > * From MyTable Where Type Like X)" > > > > A sort of sub query to set the symbol on a mass selection? Does > > something like this exist or is there only one way to do this? > > --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 11990 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 11991
