using a custom property as a sort key ?
J. Landman Gay
jacque at hyperactivesw.com
Sun Feb 29 15:07:16 EST 2004
On 2/29/04 11:28 AM, Christopher Mitchell wrote:
> On Feb 29, 2004, at 1:10 AM, J. Landman Gay wrote:
>>
>> Okay. How about:
>>
>> sort cards of this stack by (the index of this cd)
>
> That won't work unless you're on the card with Index = 1
No, it'll work. I have Jeanne's word on it, not to mention I just tried
it. :) When you are sorting cards, "this card" refers to whatever card
is currently being considered for the sort order.
> No, it's really just one thing. I want to do both. I want to
> find/goto the card with Index = 1, then sort by the index of that cd.
In Revolution, that's two things. Sorting and going are different.
> I just want to re-order a stack of cards to the numeric order that is
> in their custom property, but you have to be on the right card in
> order to do that.
No; you can be on any card. Try it. Sorting the cards is Thing One.
> I'd rather not have to go to the card and just
> sort by the index, but that doesn't seem to give any useful order.
Going to a particular card is Thing Two. Sorting does not depend on what
card you are on; the sort takes place independently of your current
location. The sort process considers the value of the sort key for each
card in the stack, and reorders them according to that value. You can
sort by your custom property no matter where you are currently located
in the stack.
Consider, for example, sorting by the value of a field:
sort cards of this stack by field "lastname"
The sort process considers the value of the field for each card, and
orders them appropriately. Another example, from the docs:
sort cards by the number of buttons
"Of this stack" is assumed. Rev considers the number of card buttons on
each card in the stack and uses that number to rearrange the cards.
sort cards by the myValue of this card -- this is the one you want
"This card" refers to whatever card Rev is currently working with during
the sort process. Rev considers the value of the custom property
"myValue" for each card, and sorts the cards according to those values.
This will restore your original sort order.
None of these sorts has anything to do with your current location in the
stack, nor does any sort take you to a particular location when it is
done. Navigation and sorting are two independent processes. When you are
done sorting, you'll probably want to make use of Ken's card marking to
find the card you want to go to.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list