That seems to be reasonable!

Peter Laulund wrote:
> 
> Hi Todd, Franz-Josef
> 
> This is a more simple way to do the job
> I think that Origx, Origy, Destx, desty and Ver_et are attributes in your
> table
> 
> dim strTabName  as string
> 
> alter table strTabName (Add Gc_dist Float, Avgsp_nmi_hr Float)
> 
> Update strTabName Set GC_DIST          = Distance( Origx, Origy, Destx,
> desty, "nmi")
> Update strTabName Set  Avgsp_nmi_hr = GC_DIST/ ( Ver_et/60 )
> 
> Peter
> 
> "Dr. Franz-Josef Behr" <[EMAIL PROTECTED]> - 09-08-2001 11:40:49
> Besvar venligst til "Dr. Franz-Josef Behr" <[EMAIL PROTECTED]>
> 
> 
> 
> 
> 
> 
> 
>  Til:        MapInfo-L <[EMAIL PROTECTED]>
> 
>  cc:         [EMAIL PROTECTED](bcc: Peter Laulund/MI/KMS)
> 
> 
> 
>  Vedr�rende: Re: MI-L MB: Alter and update table sub procedure
> 
> 
> Todd,
> 
> I think there are several problems:
> 
> 1. Put your alter table state before the loop:
>    alter table strTabName (Add Gc_dist Float, Avgsp_nmi_hr Float, Tmp_ID
> Integer)
> 
>    Tmp_ID is used for the selection (see later)
> 
> 2. Populate the field Tmp_ID with the RowID
>    Update strTabName set Tmp_ID = RowId
> 
> 3. In your lopp use an alias variable to get the values, i.e.
>    Dim aCol As Alias  ' put the dim before the loop
>    Dim fDistance, fAvgsp_nmi_hr as float
>    Dim iRowID as Integer
>    ...
>    And then try thsi:
> 
>    Fetch First from strTabName
>    while not EOT(strTabName)
>         aCol = strTabName + ".Tmp_ID"           iRowID = aCol
>         aCol = strTabName + ".Origx"           flx1 = aCol
>         ...
>         fDistance = Distance(flx1,fly1,flx2,fly2, "nmi")
>         select * from strTabName where Tmp_ID = iRowID
>         Update selection Set Gc_dist = fDistance
>         aCol = strTabName + ".Ver_et"           flx1 = flVeret
>         flVeret = Selection.Ver_et
>         Update selection Set Avgsp_nmi_hr = fDistance /(flVeret/60)
>    Fetch Next from strTabName
>    wend
> 
> I hope this helps!
> 
> --
> Mit freundlichen Gr��en / Best regards / Cordialement
> i.A.
> 
> Franz-Josef Behr
> 
> ------------------------------------------------------------------------
> We all learn by sharing what we know... (R. DiBlasi)
> 
> Dr. Franz-Josef Behr                 Phone: ++49 / 7243 / 5641-20
> GIS-Consultant                       Fax:   ++49 / 7243 / 5641-99
> Graphservice GmbH                    EMail: [EMAIL PROTECTED]
> Im Ermlisgrund 18                    D-76337 Waldbronn
> Author of: Strategisches GIS-Management - http://www.gis-management.de
> WWW: http://www.graphservice.de
> Personal Home Page: http://home.pages.de/~fjbehr und
> http://www.gis-news.de  [EMAIL PROTECTED]
> 
> ------------Original Message ----------------------------------------
> 
> From:
>            "McNeil, Todd W. (TMCNEIL)" <[EMAIL PROTECTED]> on 08/07/2001
>            04:25 PM AST
> Recipients:
> 
> "'[EMAIL PROTECTED]'"<[EMAIL PROTECTED]>
> Subject:
>            MI-L MB: Alter and update table sub procedure
> 
> Hi all, I'm having trouble getting the following line of code to even
> work
> on a table after it is compiled correctly.  What's the deal?
> 
> ' Add GC distance and Avg Speed columns and then calculate the values
> '
> 
> Sub AlterTable
> 
> dim flx1, fly1, flx2, fly2 As float
> dim flDist, flVeret As float
> 
> ' repeat for each table object
> Fetch First from strTabName
> while not EOT(strTabName)
>         alter table strTabName (Add Gc_dist Float, Avgsp_nmi_hr Float)
>         flx1 = Selection.Origx
>         fly1 = Selection.Origy
>         flx2 = Selection.Destx
>         fly2 = Selection.Desty
>         Update strTabName Set Gc_dist = Distance(flx1,fly1,flx2,fly2,
> "nmi")
>         flDist = Selection.Gc_dist
>         flVeret = Selection.Ver_et
>       Update strTabName Set Avgsp_nmi_hr = flDist/(flVeret/60)
>    Fetch Next from strTabName
> wend
> 
>  ' save work
>    commit table strTabName
> 
> end sub
> 
> _______________________________________________________________________
> 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.
> 
> Med venlig hilsen
> Peter Laulund
> 
> *************************************************************
> Kort & Matrikelstyrelsen  �  www.kms.dk
> National Survey and Cadastre - Denmark
> Rentemestervej 8  �  DK 2400 K�benhavn NV
> E-mail:  [EMAIL PROTECTED]  �  Home: [EMAIL PROTECTED]
> Phone: +45 3587 5050  �  Direct: +45 3587 5173
> 
> *************************************************************

-- 
Mit freundlichen Gr��en / Best regards / Cordialement
i.A.

Franz-Josef Behr

------------------------------------------------------------------------
We all learn by sharing what we know... (R. DiBlasi)

Dr. Franz-Josef Behr                 Phone: ++49 / 7243 / 5641-20
GIS-Consultant                       Fax:   ++49 / 7243 / 5641-99
Graphservice GmbH                    EMail: [EMAIL PROTECTED]
Im Ermlisgrund 18                    D-76337 Waldbronn
Author of: Strategisches GIS-Management - http://www.gis-management.de
WWW: http://www.graphservice.de
Personal Home Page: http://home.pages.de/~fjbehr und
http://www.gis-news.de  [EMAIL PROTECTED]



_______________________________________________________________________
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.

Reply via email to