I am trying to resequence records in a multi-record block. Each record is assigned a priority number. I am attempting to give the user the ability to move a record to a new priority and resequencing the remaining records.
Right now I have a block querying the database with order by set to priority field. I then have a when-button-pressed trigger setup to get system.cursor_record, set priority to system.cursor_record -1, then get current record from database with that same priority number and set the priority number to system.cursor_record +1, then performing a requery from database to show new list. This is a bit cumbersome because 2 retrievals are required from the database (initial and the update), then additional posts are required for updates.
What I would like to accomplish is to have the system.cursor_record (entire) record move up a priority and have the record in that position move down without the need to post until the user 'saves' the record.
I've tried using the copy built-in, but I don't think I'm using it quite right, since the only thing that actually changes is the priority number, not the position on the screen. i.e. moving the 'title' and priority number from the 3rd line to the 2nd line in the list.
Any ideas for accomplishing this would be greatly appreciated.
Thanks in advance
Right now I have a block querying the database with order by set to priority field. I then have a when-button-pressed trigger setup to get system.cursor_record, set priority to system.cursor_record -1, then get current record from database with that same priority number and set the priority number to system.cursor_record +1, then performing a requery from database to show new list. This is a bit cumbersome because 2 retrievals are required from the database (initial and the update), then additional posts are required for updates.
What I would like to accomplish is to have the system.cursor_record (entire) record move up a priority and have the record in that position move down without the need to post until the user 'saves' the record.
I've tried using the copy built-in, but I don't think I'm using it quite right, since the only thing that actually changes is the priority number, not the position on the screen. i.e. moving the 'title' and priority number from the 3rd line to the 2nd line in the list.
Any ideas for accomplishing this would be greatly appreciated.
Thanks in advance