logic help needed

Discussion in 'ASP General' started by Don Grover, Jan 17, 2004.

  1. Don Grover

    Don Grover Guest

    I have a recordset that returns company names, their are duplicates, sorted
    by company name.

    sCompanyName = ors("company")

    How can I show only one company name from each company and display nothing
    for the next name if its the same in the previouse row,

    COKE $2.14
    $2.16
    $2.16
    PEPSI $3.13
    $3.11
    $3.12
    FANTA $1.26
    $1.26


    Regards
    Don
     
    Don Grover, Jan 17, 2004
    #1
    1. Advertising

  2. http://www.aspfaq.com/2241

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Don Grover" <> wrote in message
    news:#...
    > I have a recordset that returns company names, their are duplicates,

    sorted
    > by company name.
    >
    > sCompanyName = ors("company")
    >
    > How can I show only one company name from each company and display nothing
    > for the next name if its the same in the previouse row,
    >
    > COKE $2.14
    > $2.16
    > $2.16
    > PEPSI $3.13
    > $3.11
    > $3.12
    > FANTA $1.26
    > $1.26
    >
    >
    > Regards
    > Don
    >
    >
     
    Aaron Bertrand [MVP], Jan 17, 2004
    #2
    1. Advertising

  3. Don Grover

    Ray at Guest

    Here's one way you can do it:

    <%
    Dim sOldName, sNewName, sCompanyName
    sOldName = ""

    Do While Not ors.EOF
    sNewName = ors.Fields.Item(0).Value
    sCompanyName = sNewName
    If sCompanyName = sOldName Then sCompanyName = "&nbsp;"

    %>
    <tr>
    <td><%=sCompanyName%></td>
    <td>price code here</td>
    </tr>
    <%
    sOldName = sNewName
    ors.MoveNext
    Loop

    %>

    Ray at work


    "Don Grover" <> wrote in message
    news:%...
    > I have a recordset that returns company names, their are duplicates,

    sorted
    > by company name.
    >
    > sCompanyName = ors("company")
    >
    > How can I show only one company name from each company and display nothing
    > for the next name if its the same in the previouse row,
    >
    > COKE $2.14
    > $2.16
    > $2.16
    > PEPSI $3.13
    > $3.11
    > $3.12
    > FANTA $1.26
    > $1.26
    >
    >
    > Regards
    > Don
    >
    >
     
    Ray at, Jan 17, 2004
    #3
  4. Don Grover

    Don Grover Guest

    Thanks Aaron and Ray.
    Im trying to code with a Migrain at the moment so not working on all
    thrusters :cool:.

    Regards
    Don

    "Aaron Bertrand [MVP]" <> wrote in message
    news:u%238G$...
    > http://www.aspfaq.com/2241
    >
    > --
    > Aaron Bertrand
    > SQL Server MVP
    > http://www.aspfaq.com/
    >
    >
    >
    >
    > "Don Grover" <> wrote in message
    > news:#...
    > > I have a recordset that returns company names, their are duplicates,

    > sorted
    > > by company name.
    > >
    > > sCompanyName = ors("company")
    > >
    > > How can I show only one company name from each company and display

    nothing
    > > for the next name if its the same in the previouse row,
    > >
    > > COKE $2.14
    > > $2.16
    > > $2.16
    > > PEPSI $3.13
    > > $3.11
    > > $3.12
    > > FANTA $1.26
    > > $1.26
    > >
    > >
    > > Regards
    > > Don
    > >
    > >

    >
    >
     
    Don Grover, Jan 17, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. logia
    Replies:
    6
    Views:
    651
  2. boss
    Replies:
    5
    Views:
    3,539
  3. spike
    Replies:
    8
    Views:
    1,473
    Steve Holden
    Feb 9, 2010
  4. Ryan Macy

    Ideas needed & help needed!

    Ryan Macy, Jul 19, 2006, in forum: Ruby
    Replies:
    2
    Views:
    518
    Ryan Macy
    Jul 19, 2006
  5. Ravi Prabakaran
    Replies:
    8
    Views:
    115
    Terry Reedy
    Dec 16, 2013
Loading...

Share This Page