Forums
This topic is locked
Sort repeated region
Posted 01 Nov 2002 15:16:02
1
has voted
01 Nov 2002 15:16:02 stellan karlgren posted:
Hi!I have a little problem.
I want to sort a reapeted recordset by latest answer.
I have a forum. The forum is based on an access db. Two tables where one is holding the Messageheader and the other table is holding all the answer.
I list the mainpage now with a db query that filtrering this two tables.
I sort the mainpage with latest message orderby date and time.
Now. I want to sort the repeated recordset with latest answer. This is no problem. But the topics that have no answers is placed in the beginning och the region. This is not the way i want.
I want new topics to be added in as the newest and if it´s a new answer, the topic will be lifted up.
hmmm.... this was complicated <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Anyone..
Replies
Replied 01 Nov 2002 18:42:08
01 Nov 2002 18:42:08 Brent Colflesh replied:
Dear Stellan,
Add a timestamp field to your DB and update it whenever an answer is posted - then sort on that field.
Regards,
Brent
Add a timestamp field to your DB and update it whenever an answer is posted - then sort on that field.
Regards,
Brent
Replied 01 Nov 2002 18:59:49
01 Nov 2002 18:59:49 stellan karlgren replied:
That´s the problem.
Lets say that i make a new topic.
In the first (headertable) table it creates a new post.
Then it will be placed on top of the repeated region. This is how it works now.
The query i sort in the database is mixed by this two tables.
As long as it´s no answers, there is no post in the reply table. And because of that i cant´t set a timestamp in the reply table.
I already have a "last answer date/time" in the query. But as i said, as long as it´s no answer, there is no time to sort by.
I guess that the repeat region could be sorted by a simple "If", but my mind is blocked right now.
Lets say that i make a new topic.
In the first (headertable) table it creates a new post.
Then it will be placed on top of the repeated region. This is how it works now.
The query i sort in the database is mixed by this two tables.
As long as it´s no answers, there is no post in the reply table. And because of that i cant´t set a timestamp in the reply table.
I already have a "last answer date/time" in the query. But as i said, as long as it´s no answer, there is no time to sort by.
I guess that the repeat region could be sorted by a simple "If", but my mind is blocked right now.
Replied 01 Nov 2002 21:09:27
01 Nov 2002 21:09:27 Brent Colflesh replied:
Dear Stellan,
Withoust seeing the DB it's hard to say & maybe I'm misunderstanding you, but...
Typically forums have inital posts in a "parent" table, and subsequent responses as children in a separate table - it would be simple to add a WHERE clause for SUM(children_id) > 0, if that was the way you were setup...
Can't say more w/out more specific details...
Regards,
Brent
Withoust seeing the DB it's hard to say & maybe I'm misunderstanding you, but...
Typically forums have inital posts in a "parent" table, and subsequent responses as children in a separate table - it would be simple to add a WHERE clause for SUM(children_id) > 0, if that was the way you were setup...
Can't say more w/out more specific details...
Regards,
Brent