Formatting dynamic tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Debbie Davis

    Formatting dynamic tables


    Greetings,

    I have a table called locations which holds 9 store locations. I am at
    my wit's end trying to format these like this:

    centered

    City Name(named once)
    store store store store

    next, etc.

    Here's my dilemna: Some cities only have 1 location, some have 4, some
    have 3. I don't know how to dynamically get them all centered under the
    city names (which I only need listed once) because of the different
    number of stores for each city. Thanks in advance.

    dd


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Tom B

    #2
    Re: Formatting dynamic tables

    Dim sSQL
    sSQL="SELECT CityName, StoreName from Locations ORDER BY CityName"
    Set RS=CN.Execute(s SQL)
    Dim sCurrentCity
    if not RS.EOF Then
    Do While not RS.EOF
    if sCurrentCity<>R S.Fields("CityN ame") then
    'it's the next city.
    sCurrentCity=RS .Fields("CityNa me")
    Response.Write "<br>" & sCurrentCity & "<br>"
    end if
    'Display the store name (and other information)
    Response.Write RS.Fields("Stor eName") & " "

    RS.MoveNext
    Loop
    end if
    Set RS=nothing
    CN.Close
    Set CN=nothing

    The Recordset returned will look like this.......
    Las Vegas Store1
    Las Vegas Store 2
    Paris Store3
    Paris Store4
    Paris Store5

    All you have to do is loop through the recordset, each time you get a new
    city name, then write it out.

    All leave the formatting up to you.


    "Debbie Davis" <dd@clickfocal. com> wrote in message
    news:OcNlP2J2DH A.3468@TK2MSFTN GP11.phx.gbl...[color=blue]
    >
    > Greetings,
    >
    > I have a table called locations which holds 9 store locations. I am at
    > my wit's end trying to format these like this:
    >
    > centered
    >
    > City Name(named once)
    > store store store store
    >
    > next, etc.
    >
    > Here's my dilemna: Some cities only have 1 location, some have 4, some
    > have 3. I don't know how to dynamically get them all centered under the
    > city names (which I only need listed once) because of the different
    > number of stores for each city. Thanks in advance.
    >
    > dd
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Debbie Davis

      #3
      Re: Formatting dynamic tables


      Thanks Tom. It's the formatting I'm having the problem with. I only
      need the city name once then the stores listed across under the city
      name, centered.


      San Antonio
      Store 1 Store 2 Store 3 Store 4

      Austin
      Store 1 Store 2 Store 3

      Etc.

      Where I'm having the problem is centering each row when some cities have
      4 stores, some have 2 some have 1, etc.

      Thanks anyway for your help!!


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Tom B

        #4
        Re: Formatting dynamic tables

        What HAVE you got?
        The easiest is to just use....

        <center>San Antonio</center>
        <br>
        <center>Store 1 Store 2 Store 3 Store 4</center>



        "Debbie Davis" <dd@clickfocal. com> wrote in message
        news:OdHO2aL2DH A.2700@TK2MSFTN GP11.phx.gbl...[color=blue]
        >
        > Thanks Tom. It's the formatting I'm having the problem with. I only
        > need the city name once then the stores listed across under the city
        > name, centered.
        >
        >
        > San Antonio
        > Store 1 Store 2 Store 3 Store 4
        >
        > Austin
        > Store 1 Store 2 Store 3
        >
        > Etc.
        >
        > Where I'm having the problem is centering each row when some cities have
        > 4 stores, some have 2 some have 1, etc.
        >
        > Thanks anyway for your help!!
        >
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        • Debbie Davis

          #5
          Re: Formatting dynamic tables



          Thanks again, Tom. I really didn't want to post all of this but here
          goes.

          set loc=objConn.exe cute("select * from locations")
          Response.Write "<table align=center width='100%'>"
          While NOT loc.EOF
          strCity = loc("city")
          If strCity <> strOldCity Then
          Response.Write "<tr><td valign=top colspan=4 align=center><f ont
          size=4><strong> " & strCity & "</strong></font><tr>"
          End If
          Response.write "<td align=center><s trong>" & loc("geographic ") &
          "</strong>"
          Response.write "<br><stron g>" & loc("telephone" ) & "</strong>"
          Response.Write "<br>" & loc("address") & "<br>" & loc("city") & ", " &
          loc("state") & " " & loc("zip")
          strOldCity = strCity
          loc.MoveNext
          Wend
          Response.Write "</table>"

          This works except for the formatting problem. 4 is the highest number
          of stores per city, and of course that centers properly, but the next
          city has 1, the next has 3 and they are aligned to the left. It's no
          big deal. I'll just align everything left, but it would look better
          centered.

          Many thanks again, though for all of your help. Your method works
          great, also.


          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • Alex G

            #6
            Re: Formatting dynamic tables

            This is because the rows with just 1 location aren't column spanning
            across the 4 cells, try putting each city in it's own table, try this

            set loc=objConn.exe cute("select * from locations")
            bolFirstCity = 1
            While NOT loc.EOF
            strCity = loc("city")
            If strCity <> strOldCity Then
            If not bolFirstCity = 1 then
            Response.Write "</table><br>"
            Else
            bolFirstCity = 0
            End If
            Response.Write "<table align=center width='100%'>"
            Response.Write "<tr><td valign=top colspan=4 align=center><f ont
            size=4><strong> " & strCity & "</strong></font></td></tr><tr>"
            End If
            Response.write "<td align=center><s trong>" & loc("geographic ") &
            "</strong>"
            Response.write "<br><stron g>" & loc("telephone" ) & "</strong>"
            Response.Write "<br>" & loc("address") & "<br>" & loc("city") & ", " &
            loc("state") & " " & loc("zip")
            strOldCity = strCity
            loc.MoveNext
            Wend
            Response.Write "</table>"

            Debbie Davis <dd@clickfocal. com> wrote in message news:<OlM#NxL2D HA.2156@TK2MSFT NGP12.phx.gbl>. ..[color=blue]
            > Thanks again, Tom. I really didn't want to post all of this but here
            > goes.
            >
            > set loc=objConn.exe cute("select * from locations")
            > Response.Write "<table align=center width='100%'>"
            > While NOT loc.EOF
            > strCity = loc("city")
            > If strCity <> strOldCity Then
            > Response.Write "<tr><td valign=top colspan=4 align=center><f ont
            > size=4><strong> " & strCity & "</strong></font><tr>"
            > End If
            > Response.write "<td align=center><s trong>" & loc("geographic ") &
            > "</strong>"
            > Response.write "<br><stron g>" & loc("telephone" ) & "</strong>"
            > Response.Write "<br>" & loc("address") & "<br>" & loc("city") & ", " &
            > loc("state") & " " & loc("zip")
            > strOldCity = strCity
            > loc.MoveNext
            > Wend
            > Response.Write "</table>"
            >
            > This works except for the formatting problem. 4 is the highest number
            > of stores per city, and of course that centers properly, but the next
            > city has 1, the next has 3 and they are aligned to the left. It's no
            > big deal. I'll just align everything left, but it would look better
            > centered.
            >
            > Many thanks again, though for all of your help. Your method works
            > great, also.
            >
            >
            > *** Sent via Developersdex http://www.developersdex.com ***
            > Don't just participate in USENET...get rewarded for it![/color]

            Comment

            • Roland Hall

              #7
              Re: Formatting dynamic tables

              Hi Debbie...

              Something similar to this?


              --
              Roland

              This information is distributed in the hope that it will be useful, but
              without any warranty; without even the implied warranty of merchantability
              or fitness for a particular purpose.
              -Technet Knowledge Base-

              -Technet Script Center-
              Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.

              -MSDN Library-



              Comment

              • Debbie Davis

                #8
                Re: Formatting dynamic tables

                WOW, thanks Alex. That makes perfect and also worked perfectly. Many
                thanks again!!



                *** Sent via Developersdex http://www.developersdex.com ***
                Don't just participate in USENET...get rewarded for it!

                Comment

                Working...