RunRev for iPhone and iPod Touch
Richard Gaskin
ambassador at fourthworld.com
Sat Feb 23 17:53:29 EST 2008
Björnke von Gierke wrote:
> On 23 Feb 2008, at 02:27, Richard Gaskin wrote:
>
>> Suppose you want to display records from a database in a multi-
>> column list field. You'll want to keep track of the ID field, but
>> that's just noise to the end-user so you don't want to display it.
>>
>> Currently, you'd have to parse out that column and store it in a
>> separate field. When the user clicks on a line in the list, you
>> look up the corresponding line in the ID field to do whatever you
>> need to do with that record.
>>
>> But then you want to sort the list. So you have to recombine the ID
>> field with the rest of the list contents, do the sort, then parse
>> them apart again for display.
>>
>> Ugh.
>
> Not to say this isn't a nice feature request, but removing or adding
> columns isn't exactly the rocket science you make it out to be.
Never said it was. Not sure what that's about, unless "Ugh" is some
acronym for the European Space Agency. ;)
I just said it was inconvenient, and not the sort of thing I want to
spent time teaching, nor presumably how RunRev would like to see
potential new corporate adoptees spend their time learning.
> For example:
>
> on mouseUp
> put 1 into doNotWantColumn
> put 2 into sortByThisColumn
> put the data of field 1 into theData
> sort theData by item sortByThisColumn of each
> split theData by column
> delete variable theData[doNotWantColumn]
> combine theData by column
> put theData into field 1
> end mouseUp
>
> Obviously not as simple as not showing a column in the field, and less
> memory efficient too, but on the plus side this is available now, and
> most likely faster then a modified field object (everything that has
> to do with fields is slow).
I think it would actually be the same or slower since it touches the
field data twice and requires split and combine, which are
computationally intensive on large data sets.
But moreover, your handler does something so very different from the
example I gave above that I'm not sure how it's relevant here. While
three of us have explained the value of preserving data and just hiding
it from display, if I read your handler correctly it completely deletes
the column altogether. If the data in this hidden columns were IDs,
such as in the example I gave, preserving them would be critical to
using the visible data in the field.
For performance and convenience, compare your handler to what I and the
others here are proposing with zero-width columns:
on mouseUp
sort lines of field 1 by item 2 of each
end mouseUp
With this proposed method we touch the field data no more than yours,
but most importantly we're preserving all of the data.
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode
mailing list