Stuart,
The problem might be the declaration of you function.
Function CreateRect( ByVal oLine as
Object
, ByVal fWidth as
Float
,
ByVal fOffset As
Float
,
ByVal sSide As String) as
Object
I would recomment that you add the ByVal keyword to the
variables. In this way you can actually send a column name to your function and
so let MapInfo do the looping thru an Update
statement
Update sOutputBands
Set OBJ = CreateRect(OBJ, sWidthCol, sOffSetCol, sSideCol)
This
will of course update you existing table. So if you would rather use the Loop to
control where to store the result in can be done like this. Note that you'll
have to use the Alias variable to point to the table.column.
Dim aObj, aWidth, aOffset, aSide As
Alias,
sWidthCol,
sOffSetCol, sSideCol As String,
sResultTable,
sOutputBands As String
oLine,
oRect As Object,
fWidth, fOffSet As
Float,
sSide As
String
sResultTable =
...
sOutputBands =
...
sWidthCol =
... 'set them to the name of the column
sOffSetCol =
... 'set them to the name of the column
sSideCol =
... 'set them to the name of the column
aObj = sOutputBands &
".OBJ"
aWidth = sOutputBands & "." &
sWidthCol
aOffset = sOutputBands & "." &
sOffsetCol
aSide = sOutputBands & "." &
sSideCol
FETCH First From sOutputBands
Do While NOT EOT(sOutputBands)
oLine = aObj
Do While NOT EOT(sOutputBands)
oLine = aObj
fWidth =
aWidth 'could also be a value not from the
table
fOffset = aOffset 'could
also be a value not from the table
sSide =
aSide 'could also be a value not from the
table
oRect = CreateRect(oLine, fWidth, fOffset, sSide)
Insert Into
sResultTable
(OBJ)
Values (oRect)
FETCH Next From sOutputBands
Loop
Loop
Or a third method is to insert the new rectangles
directly into the new table, like this:
Insert Into sResultTable
(OBJ)
Select CreateRect(OBJ, sWidthCol,
sOffSetCol, sSideCol) From
sOutputBands
I hope
this gave you some inspiration
Peter Horsbøll Møller
GIS Developer, MTM
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/gis
GIS Developer, MTM
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/gis
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gibb,
Stuart
Sent: Monday, October 09, 2006 5:18 PM
To: mapinfo-l@lists.directionsmag.com
Subject: [MI-L] Simple MI question. Any help appreciated
Sent: Monday, October 09, 2006 5:18 PM
To: mapinfo-l@lists.directionsmag.com
Subject: [MI-L] Simple MI question. Any help appreciated
Dear all,
I have a very simple question that is
driving me crazy.
I'm trying to create a process that
converts a table full of links (lines) into regions (simple rectangles)
depending on their values. I have managed to produce a function that calculates
the corner points and the bearing of the line. I'm just have trouble call the
function and passing variable correctly.
sOutputBands is my link table
bLine is my link object
oBand is my newly mapped region
bLine is my link object
oBand is my newly mapped region
Set ProgressBars Off
Set Map Redraw Off
FETCH First >From sOutputBands
Do While NOT EOT(sOutputBands)
???
FETCH Next From sOutputBands
Loop
Set Map Redraw On
Set ProgressBars On
Set Map Redraw Off
FETCH First >From sOutputBands
Do While NOT EOT(sOutputBands)
???
FETCH Next From sOutputBands
Loop
Set Map Redraw On
Set ProgressBars On
My function, CreateRect, works by
passing the link object, the width of the band, the offset from the original
link the region is to mapped and the side of the line to plot the
region...
Function CreateRect(bLine as Object,
bWidth as Float, bOffset As Float, bSide As String) as Object
Can anyone please advise me on how to
call my function properly and correctly pass variable. I think I've done the
hard work calculating the region corners and bearing of the line. For some
reason I'm struggling with the easy bit
i.e the ???'s in my above do
loop.
Many thanks,
Stuart
Visit our website at http://www.halcrow.com
------------------------------------------------------------------------
The contents of this email are confidential, for the sole use
of the intended recipient at the email address to which it has
been addressed and do not give rise to any binding legal
obligation upon Halcrow companies unless subsequently confirmed
on headed business notepaper sent by fax, letter or as an email
attachment. Whilst reasonable care has been taken to avoid virus
transmission, no responsibility for viruses is taken and it is
your responsibility to carry out such checks as you feel
appropriate. Emails supplied are as found and there's no
guarantee that the messages contained within the body of the
email have not been edited after receipt. If you receive this
email in error, please contact the sender immediately and delete
the message from your system.
Thank you.
-------------------------------------------------------------------------
The contents of this email are confidential, for the sole use
of the intended recipient at the email address to which it has
been addressed and do not give rise to any binding legal
obligation upon Halcrow companies unless subsequently confirmed
on headed business notepaper sent by fax, letter or as an email
attachment. Whilst reasonable care has been taken to avoid virus
transmission, no responsibility for viruses is taken and it is
your responsibility to carry out such checks as you feel
appropriate. Emails supplied are as found and there's no
guarantee that the messages contained within the body of the
email have not been edited after receipt. If you receive this
email in error, please contact the sender immediately and delete
the message from your system.
Thank you.
-------------------------------------------------------------------------
_______________________________________________ MapInfo-L mailing list MapInfo-L@lists.directionsmag.com http://www.directionsmag.com/mailman/listinfo/mapinfo-l