Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Change record order on the fly

Posted 02 Nov 2004 21:11:18
1
has voted
02 Nov 2004 21:11:18 Dan Berdusco posted:
I have a website where I am allowing members to insert records into a database. However, I am looking for a solution that will allow each user to easily move records up and down in way that the recordset is sorted.

For example, if the user had already entered 20 records, and when he enters number 21, he would like that to be 5th in the sort, is this possible.

The way i have it currently, is I have a numeric field in the database that the user can manually enter a number, and I am sorting the query by this field. But this system is a bit cumbersome for the users because if they want to add in a record into the 5th spot, they have to change the sorting number for records 5-21.

I am looking for a way to order it by possible displaying all of the records and then having buttons labeled "Move Up" and "Move Down" when clicked, it will somehow modify that specific number in the "sort" field.

Wow, i hope someone can understaind what I am trying to say and can give me a hand.

Any help is appreciated.

Thanks in advance

Replies

Replied 03 Nov 2004 00:12:35
03 Nov 2004 00:12:35 Rene Bandsma replied:
I think you need an sort of Z-index in your recordset. There are more ways to do this.

1: Add a new column to your datebase and name it e.g. "index" in this index the user puts down where he wants that the record would show up. You can do this with JavaScript or other functions if you want to give the user a nice and user friendly interface. I know that in ASP.NET this can be done with not much coding.

2: Make a textfield (or database field) that is remembering the sorting value. This textfield has al line that looks like this: "5,3,6,4,1,2". With FSO (talking about ASP(.net). you can read that textfile and bind it to your database query.

If there are more simple possibilites or extensions please let me know! This is just a way I think the problem can be tackled <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic