check out the attached response I got several years ago when
I asked the same question.  We do this all the time and it's
such a timesaver...

.................................................
www.maponics.com <http://www.maponics.com>


-----Original Message-----
From: John Polasky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 30, 2004 4:12 PM
To: [EMAIL PROTECTED]
Subject: MI-L Looping


Dear List-

Is it possible to run any kind of simple looping through the
MapBasic
command window in MapInfo??  I thought I tried it
successfully once
before, but can't remember for sure.  If it is possible, can
someone
please share the trick?   Thanks!

-John

------------------------------------------------------------
---------
List hosting provided by Directions Magazine |
www.directionsmag.com |
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
Message number: 14295


--- Begin Message ---
You are right it's alooping proces and the MapBasic window
doesn't support
this, but you can do it some how anyway.

The Loop function in the MapBasic window is called "Enter".
Do like this in
the MapBasic window write the following:

**************************************************
Dim nZip As integer
Fetch First From ZIPTABLE

nZip = ZIPTABLE.ZIPCODE

Print "Current zip code: " + nZip

'Here goes you working stuff

Fetch Next From ZIPTABLE
**************************************************

The trick is now to run the first two lines ones.
Then selecting/highlighting the remaining lines and hitting
the Enter
button.
MapInfo now runs the selected code.
If you are lucky the highligting is kept afterwards, if not
select the
remaining lines again.
And continue doing this until MapInfo reports an error "End
of table" or
something like this.

Of course if you zip code is a string replace the first line
with
Dim szZip As String
And replace nZip with szZip
ZIPTABLE and ZIPCODe should be replaced with your table and
column names.

And finally you can't use the ping (') in the MapBasic
window this will
stop the script from continuing.

Good luck,

Peter
------------------------------------------------------------
------------------------------------
Peter Horsb�ll M�ller, GIS Udviklingskonsulent /
GIS-Developer
Kampsax A/S - GIS Software & Solutions
Rugaardsvej 55, 5000 Odense, DK
tel: +45 6313 5013,  dir:+45 6313 5008,  fax: +45 6313 5090
mailto:[EMAIL PROTECTED]
www.kampsax-gis.dk and www.kampsax.dk
Authorized MapInfo Partner & Distributor in Denmark and
Norway.
------------------------------------------------------------
------------------------------------
Klik ind p� http://www.kortal.dk og se det hele lidt fra
oven!

Darrin wrote:
I'm trying to automate some mapping where I want an
individual map for
every
ZIP code in an Excel list (around 50 total).  My scrip works
fine when I
manually type in each ZIP code (thus having to run the
script 50 times).
Is
there any way to use the MapBasic window to iteratively run
the script for
each ZIP code, running down the list, until it's done (I
guess this is a
"looping" process, but I'm not a programmer, per se).  Thank
you.
*******




____________________________________________________________
___________
List hosting provided by Directions Magazine |
www.directionsmag.com |
To unsubscribe, send e-mail to
[EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.


--- End Message ---
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14296

Reply via email to