Search and Replace Tool in MapInfo V10

877 views
Skip to first unread message

Mark Dorney

unread,
Dec 1, 2009, 12:44:51 AM12/1/09
to MapInfo-L
Ever since I've been using MI V10, the Search and Replace Tool (that
is available under Tool Manager) has gone mad.

As an example, If i tried to replace the string ST with STREET, it
will replace all the ST's in the field, and then run the query again,
and again, and again, and again, until I hit stop.

I end up with STREETREETREETREETREET etc until it runs out of space.

Is it just me, or is there an incompatibility here?

Are there any other nice simple add on programs that will do the
trick?

Cheerful Regards
Mark Dorney

911mapper

unread,
Dec 1, 2009, 8:49:46 AM12/1/09
to MapInfo-L
That would be true even on the one I wrote years ago to improve the
S&R

You need to delimit you search:
"E_" > "East_"
"_ST" > "_Street"
"_MAIN_ " > "_Main_"

_ is just a space but for better visibility here, and no quotes of
course.

The search is using the form >
WHILE
SELECT * FROM SourceTable WHERE SourceCol LIKE "%"+Find+"%" INTO
ResultTable
...replace it
WEND

On Nov 30, 11:44 pm, Mark Dorney <mark.s.dor...@transport.qld.gov.au>
wrote:

Peter Horsbøll Møller

unread,
Dec 1, 2009, 10:06:10 AM12/1/09
to mapi...@googlegroups.com
There was a thread some while back regarding performance on Search & Replace.
 
This thread contains some samples on how Search and Replace can be done using MapBasic, even with source code.
I think the samples would work with your scenario and not keep replacing the text that just has been inserted.
 
If you know MapBasic it should be easy to compile these into a working Search & Replace tool.
 

Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo
 
2009/12/1 911mapper <mil...@wap3.com>

Bill Thoen

unread,
Dec 1, 2009, 12:42:22 PM12/1/09
to mapi...@googlegroups.com
Peter Horsb�ll M�ller wrote:
> There was a thread some while back regarding performance on Search &
> Replace.
> http://groups.google.dk/group/mapinfo-l/browse_thread/thread/91ca9ae63d97cfe9/f9bed6337236e74b
>
> This thread contains some samples on how Search and Replace can be
> done using MapBasic, even with source code.
> I think the samples would work with your scenario and not keep
> replacing the text that just has been inserted.
If you're going to look at any of these, look at Peter's solution. We
had a little contest to see who could build the fastest "Search &
Replace" routine in MapBsaic and Peter's straight-forward method was
unbeatable.

--
Bill Thoen
GISnet - www.gisnet.com
1401 Walnut St., Suite C
Boulder, CO 80302
303-786-9961 tel
303-443-4856 fax

Peter Horsbøll Møller

unread,
Dec 1, 2009, 12:43:42 PM12/1/09
to mapi...@googlegroups.com
Bill,
 
I remember that you said you had some more magic to try out.
Didn't any of these beat my simple approach?
 
 
Peter Horsbøll Møller
Pitney Bowes Business Insight - MapInfo

2009/12/1 Bill Thoen <bth...@gisnet.com>

Bill Thoen

unread,
Dec 2, 2009, 4:36:14 AM12/2/09
to mapi...@googlegroups.com
Peter Horsb�ll M�ller wrote:
> Bill,
>
> I remember that you said you had some more magic to try out.
> Didn't any of these beat my simple approach?

I forget now what I was going to try, but what I do remember was that
yours scaled better. I don't know how you'd express it in big-O
notation, but my recursive approach seems to slow down faster as the
number of search & replace operations increases than does yours. So I
concluded that my approach would never be faster no matter what I
tweaked because the fundamental algorithm was the problem. Still, it was
fun to explore the problem, I learned something new, and we all got a
good, speedy "search & replace" MapBasic routine for the toolkit!

--
- Bill Thoen
GISnet - www.gisnet.com
303-786-9961

Reply all
Reply to author
Forward
0 new messages