April 28, 2011 at 3:21 am
In the UI my client wants a list of rows each with a move up and move down button. I have a free hand in designing the table to support it, but I am looking for ideas.
So far I am thinking of adding a sequence column. That bit is easy. The interesting bit is choosing a datatype for it and operations to manipulate it.
choice 1 - int
To move a row now would require two updates. To move up row n requires updating the sequence number in row n and row n-1.
To insert a new row requires re-numbering all the following rows.
choice 2 - float/real
to move a row only requires updating one row. To move row n up I would calculate a new sequence number as (seq(row n-1)+seq(row n-2))/2. This is fine until we run into more fractional digits than float/real can hold.
To insert a new row requires much the same calculation
I'm sure I cannot be the first person to want this. Is there some standard approach I am missing?
April 28, 2011 at 3:37 am
richard-674310 (4/28/2011)
... Is there some standard approach I am missing?
This has been discussed on the forum before, I'll try to find the thread.
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 28, 2011 at 4:20 am
Thank you. I tried several searches before posting. Clearly I failed to hit on the magic search sauce.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply