It looks like you haven't fetched any rows so MapInfo doesn't know what
row to get the values from. Also, I would suggest using a 'Do while'
loop, rather than 'For...Next' as the later can produce unwanted results
when looping through an unpacked table for example. Based on your code,
I would imagine you want to do something like this:
Dim i as Integer,
fLong,fLat,fZoom as Float,
sName as String
Fetch first from mytable 'Fetches first row from table
Do while not EOT(mytable)
'Get values from row
fLong = mytable.long
fLat = mytable.lat
fZoom = mytable.zm
sName = mytable.name
Set Map Window 123456789 Center(fLong,fLat) Zoom fZoom Units
"km"
Save Window 123456789 As sName Type "EMF" Width 800 Height 600
Fetch next from mytable 'Fetch next row
Loop
I haven't checked this for errors, but that should point you in the
right direction!
Regards,
Tom Bacon
Graduate GIS Engineer
Asset Management South
Tel: 01444 472380
www.mouchel.com
Hi
thanks
Rob
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. Mouchel Limited, Registered in England at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX Registered No : 1686040
Regards
Adrian Gray
Viewshed Limited
w: www.viewshed.co.uk
t: 01392 861946
Orchard House Church Road Silverton Exeter EX5 4PD
registered in England and Wales: 5661115 VAT# 876 6186 72
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Behalf Of RobShaw
Sent: 10 February 2012 14:22
To: MapInfo-L
Subject: [MI-L] Create mapbasic loop to move and save window
Hi
thanks
Rob
--
Zery, are you saying you're only getting one EMF *file* out of this? Or that there is a file for each value of mytable.name and they all have the same view in them?
If you're only getting one file, make sure that the save window statement is inside the loop, or that the names in the table are different….
Spencer
If you're going to keep up guessing about the structure of your code, I'd guess that an Update Window statement between the Set Window and the Save Window might help matters. And make sure you have a "fetch first" before the loop and are getting your field values from aliases.
You need to use alias variables if you are substituting a table (or column) name with a variable:
Declare Sub mytest(windname As string)
Sub mytest(windname As string)
Dim fLat As Float
Dim fLong As Float
Dim fZoom As Float
Dim sname as String
Dim tabname as String
Dim aFLong, aFLat, aFZoom, aSName as Alias
tabname = TableInfo(1,1)
aFLong = tabname & ".long" '<- Assign alias values
aFLat = tabname & ".lat"
aFZoom = tabname & ".dist"
aSName = tabname & ".CCG"
Fetch first from tabname
Do while not EOT(tabname)
fLong = aFLong '<- Use alias rather than string variable
fLat = aFLat
fzoom = aFZoom
sname = aSName
...
Hope this helps,
Tom Bacon
Graduate GIS Engineer
Asset Management South
Tel: 01444 472380
www.mouchel.com