Advertisement

01.18.2005 at 03:15PM PST, ID: 21279499
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Ordering data pulled from a database

Asked by jrt01uk in Active Server Pages (ASP)

Hi,

Sorry, i'm not sure how to describe this one -  its not quite as simple as the title suggests ;)

OK, I have a database containing the following data:

name   |    id1    |    note1    |    date1    |     id2     |     note2     |      date2     |   id3    |    note3    |    date3   |   . . .  up to  . . . id, note, date 20

record1|     3      |    notex    |  01/12/04 |      and so on.... with the id# having a number in it, the note having a text message of some description, and the date being a date field.

Depending on the users input, the query pulls a certain record from the table (e.g. record1) and then lists id1, note1 and date1 in a three column row, then id2, note2 and date2 in the next row, and so on:

record1:

    id1   |     note1      |     date1     |
    id2   |     note2      |     date2     |
    id3   |     note3      |     date3     |
    id4   |     note4      |     date4     |

etc...

It does this using this script:

Dim intLoop
For intLoop = 1 to 21

If rs3("id" & intLoop) = 0 Then                    'checks if id# has data in, if the id field is blank, then there will be no more rows printed
Response.Write " "                                     'prints some html to show the end of the table has been reached
Exit For                                                     'exits the loop if this condition holds
End If

Response.Write "<tr bordercolor=""#fcb514""><td style=""font-weight:normal;text-align:center"">" & rs4("text") & "</td><td style=""font-weight:normal;text-align:center"">" & rs3("note" & intLoop) & "</td><td style=""font-weight:normal;text-align:center"">" & Day(rs3("date" & intLoop)) & " " & MonthName(Month(rs3("date" & intLoop)),1) & " " & Year(rs3("date" & intLoop)) & "</td>"

                                                                'that massive chunk prints id1, note1 and date1
Next                                                          'it then goes to the next intLoop integer, and prints id2, note2, date2... and so on.


My problem is, I'm looking for a way to order the date field. Its not just as simple as adding an 'ORDER BY date' in the SQL query because there are up to 20 date fields on the screen. I'm looking to sort the date1, date2, date3 etc into order, and then print each one, one row at a time, printing that corresponding id# and note# with it.

This so far is stumping me. Has anyone got any ideas? Is it clear what I'm asking??
Thanks for your help :)

JasonStart Free Trial
 
Loading Advertisement...
 
[+][-]01.18.2005 at 03:52PM PST, ID: 13078308

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.18.2005 at 09:44PM PST, ID: 13079957

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.18.2005 at 11:50PM PST, ID: 13080324

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Sign Up Now!
Solution Provided By: NeilT
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44