Results 1 to 2 of 2

Thread: problem with retrieving values from a string

  1. #1

    Thread Starter
    Member
    Join Date
    May 2000
    Location
    London, UK
    Posts
    39

    Cool

    I have the following code and not retrieving the values.


    <% @Language = "VBScript" %>
    <% Response.buffer = true %>

    <%
    Dim Msg
    Dim Lat
    Dim Lon
    Dim Map


    Msg = Maps & "," & Lon &"," & Lat


    ' Lat=Request.QueryString("Lat")
    ' Lon=Request.QueryString("Lon")
    ' Map=Request.QueryString("Map")

    Map = "OS2000.Map"

    userid="1"

    Lat = "50.748867"
    Lon = "-001.554733"



    Dim finalm

    Set finalm = Server.CreateObject("DLLCall.Geomanconv")

    RetStr=finalm.GEOMANCODE(Lat,Lon,Map)



    Dim RetStr ' a variable to hold the original string value
    Dim arrWork1 ' a variable to hold the split array of pairs
    Dim arrWork2 ' a variable to hold the split array of name/value
    Dim i ' a loop counter

    ' assume that the contents are all in a string called sString



    ' sString = "Res=Map=OS2000.Map, MapO=2, Lat1=50.708286, " & _
    ' "Lat2=50.798220, " & vbcrlf & _
    ' "Lat3=50.797615, Lat4=50.707683, Lon1=-001.575082, " & _
    ' "Lon2=-001.574267, " & vbcrlf & _
    ' "Lon3=-001.432362, Lon4=-001.433449 , Page=7, XCur=14, " & _
    ' "YCur=45, Col= H, " & vbcrlf & _
    ' "Row= 5 , Page=12, XCur=14, YCur=45, Col= G, Row= 7"


    ' next, let's get rid of all the spurious carriage returns and line
    'feeds...

    RetStr = Replace(RetStr, vbCrfl, "")

    ' split the string into an array at each comma

    arrWork1 = Split(RetStr, ",")
    For i = LBound(arrWork1) to UBound(arrWork1)


    ' split the current pair into name and value
    ' at the first equals sign...

    arrWork2 = Split(arrWork1(i), "=", 2)
    Response.Write "Name is [" & _
    Trim(arrWork2(LBound(arrWork2))) & "]"
    Response.Write ", Value is [" & _
    Trim(arrWork2(UBound(arrWork2))) & "]<BR"
    Erase arrWork2 ' clear the array
    Next
    Erase arrWork1 ' clear the array



    %>

    <%="Res="&Page%>


    %>


    <!-- <%="Res="&RetStr%> -->


    This is what is being output on the web page.




    Name is [Map], Value is [OS2000.Map]


    Not what I am expecting.



    Name is [res], value is [map is os2000.map]
    name is [map0], value is [2]
    name is [lat1], value is [50.708286]
    name is [lat2], value is [50.798220]
    name is [lat3], value is [50.707683]
    name is [lon1], value is [-001.575082]
    name is [lon2], value is [-001.432362]
    name is [lon3], value is [-001.433449]
    name is [page], value is [7]
    name is [xcur], value is [14]
    name is [ycur], value is [45]
    name is [col], value is [h]
    name is [row], value is [5]
    name is [page], value is [12]
    name is [xcur], value is [14]
    name is [ycur], value is [45]
    name is [col], value is [g]
    name is [row], value is [7]



    Please can you let me know how I can resolve this problem.


  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Your problem is a missing > of the <BR> tag within the for loop!
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width