= Parent & Child, ASP output question =

  • Hi, all!

    I have this problem for a while:

    When i build an web application, sometimes i have to "drill down" data on a particular page..... Something like "For a parent record i want to display `n´ child records...", like in the following schema:

    ID     SUBJECT           DATE/TIME            SUB.CATS

    =============================================

    001   Parent Record1    24/06, 9:00AM       --

                                                             Child.Record #1

                                                             Child.Record #2

                                                             Child.Record #3

    002   Parent Record2    23/06, 7:50AM       --

                                                             Child.Record #1

                                                             Child.Record #2

                                                             (...)

    (...)

    =============================================

    Im sure that thios is a common question, but i havent seen a satisfatory awser anywhere...

    So, to you developers: What's the best way to code this stuff???

    Right now, my workaround is to "SELECT tb.A INNER JOIN tb.B ...", get duplicated rows, and at the ASP scope, i do something like:

    While not rs.EOF then

          if MyTempIDVar = rs(ID).value Then

               Append_ChildRowsData()

          else

               Build_NewParentRow()

          en dif

          MyTempIDVar = rs(ID).value

          rs.MoveNext

    Loop

    Thats a cumbersome solution, and leads me to some problems:

    I must always ORDER BY ID, because is the only Unique Identifier in the data, and the only way to garantee the correct display of the data on the html page!

    Can anyone help???

    Much appreciated


    LabDev

    labdev@iol.pt

  • This was removed by the editor as SPAM

  • Everything I have tried and seen this is the basic way of getting it done like you have it. The only thing I have seen otherwise is to build the rows in SQL (similarly using a temp table) keep them ordered the way you need them then dump the temp table out and you can potentially do all your html there as well. No real magic bullet at this point.

  • Well, i image that!

    There is no "easy" way, right!?

    Any way, thanxs fro the tip!!!

     


    LabDev

    labdev@iol.pt

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply