Dick,

I think I see what the problem is. I've thought about this before, but
don't truly have enough programming background to come up with the
proper solution. In changing the sort order of an item from 5 to 7 you
also have to change item 6 to now be 5, item 7 to then be 6 and then you
have the new 7. This would require that the old 5 become a temporary
record until the other three items have been reordered. I had a similar
project once in a C++ class dealing with changing the sort order of an
array. I think that this would have to be a good mix of SQL and CF
programmatic code in order to make this work effectively. Possibly

a) Select * from MyTable where SortOrder >= 5 and <= 7
b) Store the query results in an array or struct
c) Perform the sort order change on the array or struct
d) loop through the array doing an Update MyTable ... where SortOrder = x

Something like that.

Cutter

Dick Applebaum wrote:
> UPDATE MyTable set SortOrder = 7 WHERE sortOrder =5
>
> On Mar 22, 2004, at 7:49 AM, Critter wrote:
>
>  > Hello cf-talk,
>  >
>  >    I've  got  a  column  in a db that handles the sort order, I need to
>  >    give  the admins a way to change the order of things... so let's say
>  >    they want to change the order of #5 to #7
>  >
>  >    does  anyone know of any decent way to do this.... or am I forced to
>  >    just keep looping through things......
>  >
>  >    /crit
>  >
>  >  --
>  >  Critter G
>  >
>  >  --
>  >  [This E-mail scanned for viruses by Declude Virus]
>  >
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to