Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Splitting values

    Hi All...

    I am really stumped on something I am trying to do.

    I have a table named games with the following fields: gameID, homeTeam,
    homeScore, visitingTeam, vistingScore.

    When I pull records thusly: (two records in this instance)
    Select * from games
    then display all the records with a do while loop, everything comes in all
    right, but I need to create a string value that would look somthing like
    hometeam homescore visitingteam visitingscore, hometeam homescore
    visitingteam visiting score.
    I need to be able to use this string as a scroll.

    I can create a string by using getRows, and comma delimit it, but I end up
    with:
    homeTeam,homeScore,visitingTeam,visitingScore,

    Any advice or help would be very much appreciated.

    Steve G


    Steve G Guest

  2. Similar Questions and Discussions

    1. Intelligent PDF Splitting
      Does anyone have information about intelligent PDF splitting, using either command line or applescript?
    2. Splitting a CSV list
      I have the following type of data in a page and I need to be able to pull each and every CN value without the CN or anything behind it. ...
    3. PHP variable splitting
      Is there a command in PHP that will allow me to split a text variable into an array by length rather than using a delimiter? What I want to do is...
    4. Splitting a Logo
      Hi Is it possible to split a Logo cleanly in half and if so how would i do this? TOON TOON.
    5. Splitting up an XML File
      I have an XML file that looks like this: <root> <economist publications="true" > <name> <first>John</first> <last>Doe</last> </name>...
  3. #2

    Default Re: Splitting values Correction

    Sorry...just realized I mis-discribed the SQL statement, it should be:
    Select homeTeam, homeScore, visitingTeam, visitingScore from games

    Steve

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    > Hi All...
    >
    > I am really stumped on something I am trying to do.
    >
    > I have a table named games with the following fields: gameID, homeTeam,
    > homeScore, visitingTeam, vistingScore.
    >
    > When I pull records thusly: (two records in this instance)
    > Select * from games
    > then display all the records with a do while loop, everything comes in all
    > right, but I need to create a string value that would look somthing like
    > hometeam homescore visitingteam visitingscore, hometeam homescore
    > visitingteam visiting score.
    > I need to be able to use this string as a scroll.
    >
    > I can create a string by using getRows, and comma delimit it, but I end up
    > with:
    > homeTeam,homeScore,visitingTeam,visitingScore,
    >
    > Any advice or help would be very much appreciated.
    >
    > Steve G
    >
    >

    Steve G Guest

  4. #3

    Default Re: Splitting values Correction

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:uoKO27rlDHA.964@TK2MSFTNGP10.phx.gbl...
    > Sorry...just realized I mis-discribed the SQL statement, it should be:
    > Select homeTeam, homeScore, visitingTeam, visitingScore from games
    >
    > Steve
    >
    > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    > > Hi All...
    > >
    > > I am really stumped on something I am trying to do.
    > >
    > > I have a table named games with the following fields: gameID, homeTeam,
    > > homeScore, visitingTeam, vistingScore.
    > >
    > > When I pull records thusly: (two records in this instance)
    > > Select * from games
    > > then display all the records with a do while loop, everything comes in
    all
    > > right, but I need to create a string value that would look somthing like
    > > hometeam homescore visitingteam visitingscore, hometeam homescore
    > > visitingteam visiting score.
    > > I need to be able to use this string as a scroll.
    > >
    > > I can create a string by using getRows, and comma delimit it, but I end
    up
    > > with:
    > > homeTeam,homeScore,visitingTeam,visitingScore,
    > >
    > > Any advice or help would be very much appreciated.
    > >
    > > Steve G
    I may not understand your problem but here goes...

    If you can get :
    homeTeam,homeScore,visitingTeam,visitingScore

    and you want :
    homeTeam homeScore visitingTeam visitingScore

    and it's returned in a string ("s"), try :

    s = Replace(s,","," ")

    Also, what do you mean by :
    "I need to be able to use this string as a scroll."?


    McKirahan Guest

  5. #4

    Default Re: Splitting values Correction

    Thanks for the response.

    The idea is that we will pull scores dynamically from the database, as they
    are entered by coaches, and then place them in a scroll across the top of
    the page.

    If I am interpreting your suggestion correctly, and there are scores from
    two games posted, I think I would end up with:

    homeTeam homeScore visitingTeam visitingScore homeTeam homeScore
    visitingTeam visitingScore

    instead of:

    homeTeam homeScore visitingTeam visitingScore,homeTeam homeScore
    visitingTeam visitingScore,

    I need to be able to split on the commas in the above string, so I can
    create dynamically parameter values for each game, but obviously, first I
    need to be able to create the string.

    Thanks

    Steve G

    "McKirahan" <News@McKirahan.com> wrote in message
    news:OuJkb.823058$YN5.851331@sccrnsc01...
    > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > news:uoKO27rlDHA.964@TK2MSFTNGP10.phx.gbl...
    > > Sorry...just realized I mis-discribed the SQL statement, it should be:
    > > Select homeTeam, homeScore, visitingTeam, visitingScore from games
    > >
    > > Steve
    > >
    > > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > > news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    > > > Hi All...
    > > >
    > > > I am really stumped on something I am trying to do.
    > > >
    > > > I have a table named games with the following fields: gameID,
    homeTeam,
    > > > homeScore, visitingTeam, vistingScore.
    > > >
    > > > When I pull records thusly: (two records in this instance)
    > > > Select * from games
    > > > then display all the records with a do while loop, everything comes in
    > all
    > > > right, but I need to create a string value that would look somthing
    like
    > > > hometeam homescore visitingteam visitingscore, hometeam homescore
    > > > visitingteam visiting score.
    > > > I need to be able to use this string as a scroll.
    > > >
    > > > I can create a string by using getRows, and comma delimit it, but I
    end
    > up
    > > > with:
    > > > homeTeam,homeScore,visitingTeam,visitingScore,
    > > >
    > > > Any advice or help would be very much appreciated.
    > > >
    > > > Steve G
    >
    > I may not understand your problem but here goes...
    >
    > If you can get :
    > homeTeam,homeScore,visitingTeam,visitingScore
    >
    > and you want :
    > homeTeam homeScore visitingTeam visitingScore
    >
    > and it's returned in a string ("s"), try :
    >
    > s = Replace(s,","," ")
    >
    > Also, what do you mean by :
    > "I need to be able to use this string as a scroll."?
    >
    >

    Steve G Guest

  6. #5

    Default Re: Splitting values Correction

    This is simple string manipulation. If you want a comma at the end of every
    record, you can use GetString with no column delimiter, and a , as a row
    delimiter. If you want to use GetRows then, you can do:

    <%
    If isArray(arrResults) then

    For i = 0 to UBound(arrResults, 2)

    For j = 0 to Ubound(arrResults, 1)

    strValue = strValue & " " & arrResults(j,i)

    Next

    strValue = strValue & ", "

    Next

    End If
    %>

    If you want to strip the trailing comma (no comma after the last set of
    results) then

    <%
    strValue = Left(strValue, Len(strValue) -1)
    %>

    Cheers
    Ken


    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:e536EXslDHA.1488@TK2MSFTNGP12.phx.gbl...
    : Thanks for the response.
    :
    : The idea is that we will pull scores dynamically from the database, as
    they
    : are entered by coaches, and then place them in a scroll across the top of
    : the page.
    :
    : If I am interpreting your suggestion correctly, and there are scores from
    : two games posted, I think I would end up with:
    :
    : homeTeam homeScore visitingTeam visitingScore homeTeam homeScore
    : visitingTeam visitingScore
    :
    : instead of:
    :
    : homeTeam homeScore visitingTeam visitingScore,homeTeam homeScore
    : visitingTeam visitingScore,
    :
    : I need to be able to split on the commas in the above string, so I can
    : create dynamically parameter values for each game, but obviously, first I
    : need to be able to create the string.
    :
    : Thanks
    :
    : Steve G
    :
    : "McKirahan" <News@McKirahan.com> wrote in message
    : news:OuJkb.823058$YN5.851331@sccrnsc01...
    : > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    : > news:uoKO27rlDHA.964@TK2MSFTNGP10.phx.gbl...
    : > > Sorry...just realized I mis-discribed the SQL statement, it should be:
    : > > Select homeTeam, homeScore, visitingTeam, visitingScore from games
    : > >
    : > > Steve
    : > >
    : > > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    : > > news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    : > > > Hi All...
    : > > >
    : > > > I am really stumped on something I am trying to do.
    : > > >
    : > > > I have a table named games with the following fields: gameID,
    : homeTeam,
    : > > > homeScore, visitingTeam, vistingScore.
    : > > >
    : > > > When I pull records thusly: (two records in this instance)
    : > > > Select * from games
    : > > > then display all the records with a do while loop, everything comes
    in
    : > all
    : > > > right, but I need to create a string value that would look somthing
    : like
    : > > > hometeam homescore visitingteam visitingscore, hometeam homescore
    : > > > visitingteam visiting score.
    : > > > I need to be able to use this string as a scroll.
    : > > >
    : > > > I can create a string by using getRows, and comma delimit it, but I
    : end
    : > up
    : > > > with:
    : > > > homeTeam,homeScore,visitingTeam,visitingScore,
    : > > >
    : > > > Any advice or help would be very much appreciated.
    : > > >
    : > > > Steve G
    : >
    : > I may not understand your problem but here goes...
    : >
    : > If you can get :
    : > homeTeam,homeScore,visitingTeam,visitingScore
    : >
    : > and you want :
    : > homeTeam homeScore visitingTeam visitingScore
    : >
    : > and it's returned in a string ("s"), try :
    : >
    : > s = Replace(s,","," ")
    : >
    : > Also, what do you mean by :
    : > "I need to be able to use this string as a scroll."?
    : >
    : >
    :
    :


    Ken Schaefer Guest

  7. #6

    Default Re: Splitting values Correction

    Yep..that did the trick...

    As always, thanks, Ken

    Steve G

    "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
    news:OrjAWbslDHA.2080@TK2MSFTNGP10.phx.gbl...
    > This is simple string manipulation. If you want a comma at the end of
    every
    > record, you can use GetString with no column delimiter, and a , as a row
    > delimiter. If you want to use GetRows then, you can do:
    >
    > <%
    > If isArray(arrResults) then
    >
    > For i = 0 to UBound(arrResults, 2)
    >
    > For j = 0 to Ubound(arrResults, 1)
    >
    > strValue = strValue & " " & arrResults(j,i)
    >
    > Next
    >
    > strValue = strValue & ", "
    >
    > Next
    >
    > End If
    > %>
    >
    > If you want to strip the trailing comma (no comma after the last set of
    > results) then
    >
    > <%
    > strValue = Left(strValue, Len(strValue) -1)
    > %>
    >
    > Cheers
    > Ken
    >
    >
    > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > news:e536EXslDHA.1488@TK2MSFTNGP12.phx.gbl...
    > : Thanks for the response.
    > :
    > : The idea is that we will pull scores dynamically from the database, as
    > they
    > : are entered by coaches, and then place them in a scroll across the top
    of
    > : the page.
    > :
    > : If I am interpreting your suggestion correctly, and there are scores
    from
    > : two games posted, I think I would end up with:
    > :
    > : homeTeam homeScore visitingTeam visitingScore homeTeam homeScore
    > : visitingTeam visitingScore
    > :
    > : instead of:
    > :
    > : homeTeam homeScore visitingTeam visitingScore,homeTeam homeScore
    > : visitingTeam visitingScore,
    > :
    > : I need to be able to split on the commas in the above string, so I can
    > : create dynamically parameter values for each game, but obviously, first
    I
    > : need to be able to create the string.
    > :
    > : Thanks
    > :
    > : Steve G
    > :
    > : "McKirahan" <News@McKirahan.com> wrote in message
    > : news:OuJkb.823058$YN5.851331@sccrnsc01...
    > : > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > : > news:uoKO27rlDHA.964@TK2MSFTNGP10.phx.gbl...
    > : > > Sorry...just realized I mis-discribed the SQL statement, it should
    be:
    > : > > Select homeTeam, homeScore, visitingTeam, visitingScore from games
    > : > >
    > : > > Steve
    > : > >
    > : > > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > : > > news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    > : > > > Hi All...
    > : > > >
    > : > > > I am really stumped on something I am trying to do.
    > : > > >
    > : > > > I have a table named games with the following fields: gameID,
    > : homeTeam,
    > : > > > homeScore, visitingTeam, vistingScore.
    > : > > >
    > : > > > When I pull records thusly: (two records in this instance)
    > : > > > Select * from games
    > : > > > then display all the records with a do while loop, everything
    comes
    > in
    > : > all
    > : > > > right, but I need to create a string value that would look
    somthing
    > : like
    > : > > > hometeam homescore visitingteam visitingscore, hometeam homescore
    > : > > > visitingteam visiting score.
    > : > > > I need to be able to use this string as a scroll.
    > : > > >
    > : > > > I can create a string by using getRows, and comma delimit it, but
    I
    > : end
    > : > up
    > : > > > with:
    > : > > > homeTeam,homeScore,visitingTeam,visitingScore,
    > : > > >
    > : > > > Any advice or help would be very much appreciated.
    > : > > >
    > : > > > Steve G
    > : >
    > : > I may not understand your problem but here goes...
    > : >
    > : > If you can get :
    > : > homeTeam,homeScore,visitingTeam,visitingScore
    > : >
    > : > and you want :
    > : > homeTeam homeScore visitingTeam visitingScore
    > : >
    > : > and it's returned in a string ("s"), try :
    > : >
    > : > s = Replace(s,","," ")
    > : >
    > : > Also, what do you mean by :
    > : > "I need to be able to use this string as a scroll."?
    > : >
    > : >
    > :
    > :
    >
    >

    Steve G Guest

  8. #7

    Default Re: Splitting values

    Hi,

    why don't you to this :

    select gameID,
    homeTeam + ' ' + homeScore as HOME,
    visitingTeam + ' ' + vistingScore as VISIT
    from games

    ----so you will get per game the both teams and scores.

    So for : hometeam homescore - visitingteam visitingscore

    select gameID,
    homeTeam + ' ' + homeScore + ' - 'visitingTeam + ' ' +
    vistingScore as MYTEXT
    from games
    ---- so you will get per game the whole string MYTEXT you need

    Hope that helps you !

    Ann
    "Steve G" <steve@nospam.tnccreations.com> wrote in message news:<uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl>...
    > Hi All...
    >
    > I am really stumped on something I am trying to do.
    >
    > I have a table named games with the following fields: gameID, homeTeam,
    > homeScore, visitingTeam, vistingScore.
    >
    > When I pull records thusly: (two records in this instance)
    > Select * from games
    > then display all the records with a do while loop, everything comes in all
    > right, but I need to create a string value that would look somthing like
    > hometeam homescore visitingteam visitingscore, hometeam homescore
    > visitingteam visiting score.
    > I need to be able to use this string as a scroll.
    >
    > I can create a string by using getRows, and comma delimit it, but I end up
    > with:
    > homeTeam,homeScore,visitingTeam,visitingScore,
    >
    > Any advice or help would be very much appreciated.
    >
    > Steve G
    Anorlu Guest

  9. #8

    Default Re: Splitting values-Count

    Hi All...

    One last question, I hope <S>

    Utilizing what Ken gave me, I now have the team name and score coming in
    correctly. I now need to set one additional parameter value, which is
    basically a count.

    If I use this: (where there are two records)
    for m = 1 to count
    caption = caption + 1
    response.write caption
    next

    the result is (1)(2) (parenthesis added for clarity).

    This makes sense from the syntax, but I need it to read (0)(1) - working
    with an applet, whose first parameter caption value must be 0.

    As always, any help would be much appreciated.

    Steve G

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    > Hi All...
    >
    > I am really stumped on something I am trying to do.
    >
    > I have a table named games with the following fields: gameID, homeTeam,
    > homeScore, visitingTeam, vistingScore.
    >
    > When I pull records thusly: (two records in this instance)
    > Select * from games
    > then display all the records with a do while loop, everything comes in all
    > right, but I need to create a string value that would look somthing like
    > hometeam homescore visitingteam visitingscore, hometeam homescore
    > visitingteam visiting score.
    > I need to be able to use this string as a scroll.
    >
    > I can create a string by using getRows, and comma delimit it, but I end up
    > with:
    > homeTeam,homeScore,visitingTeam,visitingScore,
    >
    > Any advice or help would be very much appreciated.
    >
    > Steve G
    >
    >

    Steve G Guest

  10. #9

    Default Re: Splitting values-Count

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:u132n9wlDHA.1084@tk2msftngp13.phx.gbl...
    > Hi All...
    >
    > One last question, I hope <S>
    >
    > Utilizing what Ken gave me, I now have the team name and score coming in
    > correctly. I now need to set one additional parameter value, which is
    > basically a count.
    >
    > If I use this: (where there are two records)
    > for m = 1 to count
    > caption = caption + 1
    > response.write caption
    > next
    >
    > the result is (1)(2) (parenthesis added for clarity).
    >
    > This makes sense from the syntax, but I need it to read (0)(1) - working
    > with an applet, whose first parameter caption value must be 0.
    >
    > As always, any help would be much appreciated.
    >
    > Steve G
    >
    for m = 0 to count


    McKirahan Guest

  11. #10

    Default Re: Splitting values-Count

    You're right...sorry, going on a little sleep deprivation here. That should
    have read m = 0 to count which would then produce the results I described
    below; i.e., (1)(2)

    Steve


    "McKirahan" <News@McKirahan.com> wrote in message
    news:xJRkb.826200$YN5.856708@sccrnsc01...
    > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > news:u132n9wlDHA.1084@tk2msftngp13.phx.gbl...
    > > Hi All...
    > >
    > > One last question, I hope <S>
    > >
    > > Utilizing what Ken gave me, I now have the team name and score coming in
    > > correctly. I now need to set one additional parameter value, which is
    > > basically a count.
    > >
    > > If I use this: (where there are two records)
    > > for m = 1 to count
    > > caption = caption + 1
    > > response.write caption
    > > next
    > >
    > > the result is (1)(2) (parenthesis added for clarity).
    > >
    > > This makes sense from the syntax, but I need it to read (0)(1) - working
    > > with an applet, whose first parameter caption value must be 0.
    > >
    > > As always, any help would be much appreciated.
    > >
    > > Steve G
    > >
    >
    > for m = 0 to count
    >
    >

    Steve G Guest

  12. #11

    Default Re: Splitting values-Count

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:OJqBdJxlDHA.2432@TK2MSFTNGP10.phx.gbl...
    > You're right...sorry, going on a little sleep deprivation here. That
    should
    > have read m = 0 to count which would then produce the results I described
    > below; i.e., (1)(2)
    >
    > Steve
    >
    >
    > "McKirahan" <News@McKirahan.com> wrote in message
    > news:xJRkb.826200$YN5.856708@sccrnsc01...
    > > "Steve G" <steve@nospam.tnccreations.com> wrote in message
    > > news:u132n9wlDHA.1084@tk2msftngp13.phx.gbl...
    > > > Hi All...
    > > >
    > > > One last question, I hope <S>
    > > >
    > > > Utilizing what Ken gave me, I now have the team name and score coming
    in
    > > > correctly. I now need to set one additional parameter value, which is
    > > > basically a count.
    > > >
    > > > If I use this: (where there are two records)
    > > > for m = 1 to count
    > > > caption = caption + 1
    > > > response.write caption
    > > > next
    > > >
    > > > the result is (1)(2) (parenthesis added for clarity).
    > > >
    > > > This makes sense from the syntax, but I need it to read (0)(1) -
    working
    > > > with an applet, whose first parameter caption value must be 0.
    > > >
    > > > As always, any help would be much appreciated.
    > > >
    > > > Steve G
    > > >
    > >
    > > for m = 0 to count
    > >

    You'll have to post your code.

    I didn't see a variable named "caption" in Ken's code.

    What is it initialized to?


    McKirahan Guest

  13. #12

    Default Re: Splitting values-Count

    caption = 0
    For m = 1 to count
    Response.Write(caption)
    caption = caption + 1
    Next

    Cheers
    Ken

    "Steve G" <steve@nospam.tnccreations.com> wrote in message
    news:u132n9wlDHA.1084@tk2msftngp13.phx.gbl...
    : Hi All...
    :
    : One last question, I hope <S>
    :
    : Utilizing what Ken gave me, I now have the team name and score coming in
    : correctly. I now need to set one additional parameter value, which is
    : basically a count.
    :
    : If I use this: (where there are two records)
    : for m = 1 to count
    : caption = caption + 1
    : response.write caption
    : next
    :
    : the result is (1)(2) (parenthesis added for clarity).
    :
    : This makes sense from the syntax, but I need it to read (0)(1) - working
    : with an applet, whose first parameter caption value must be 0.
    :
    : As always, any help would be much appreciated.
    :
    : Steve G
    :
    : "Steve G" <steve@nospam.tnccreations.com> wrote in message
    : news:uKbT63rlDHA.2616@TK2MSFTNGP11.phx.gbl...
    : > Hi All...
    : >
    : > I am really stumped on something I am trying to do.
    : >
    : > I have a table named games with the following fields: gameID, homeTeam,
    : > homeScore, visitingTeam, vistingScore.
    : >
    : > When I pull records thusly: (two records in this instance)
    : > Select * from games
    : > then display all the records with a do while loop, everything comes in
    all
    : > right, but I need to create a string value that would look somthing like
    : > hometeam homescore visitingteam visitingscore, hometeam homescore
    : > visitingteam visiting score.
    : > I need to be able to use this string as a scroll.
    : >
    : > I can create a string by using getRows, and comma delimit it, but I end
    up
    : > with:
    : > homeTeam,homeScore,visitingTeam,visitingScore,
    : >
    : > Any advice or help would be very much appreciated.
    : >
    : > Steve G
    : >
    : >
    :
    :


    Ken Schaefer Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139