using a custom property as a sort key ?

Christopher Mitchell chrism at lumin.us
Sat Feb 28 23:55:10 EST 2004


On Feb 28, 2004, at 10:07 PM, J. Landman Gay wrote:
>>
>> Is it possible to use a custom property as a sort key?
>
> You mean, to sort cards?

yes, as you guessed to resort them back to their native order

>
> I'm not sure I'm clear on what you want to do, but if it is to return 
> the cards to their "native" order, then the usual method is to place 
> the index number into a hidden background field (a grouped field) that 
> is placed on all cards. Then you can just "sort cards of this stack by 
> fld 'index'".

well, that's what I want to do by custom property.  the trouble is if 
you don't sort on the card whether by field or customer property with 
value 1, they get sorted in a VERY bizarre order.  I can't even really 
explain what the order is based on if you did a "sort cards of this 
stack by this card" on a card that was not actually the first one.

using a hidden background field to do the work of a custom property is 
a kludge.

> If you are just trying to go to a card with a certain index number 
> rather than trying to rearrange the cards, then a naming convention is 
> easiest. Name your cards "flash1", "flash2", etc. Then you can:
>
>  go cd ("flash"&index)

can't do this as the card names are already tied into associated 
audiofiles.

> Another way: keep the custom card properties and when the stack starts 
> up, create an array by scanning through all the cards and storing 
> their index property number along with the card ID. Then when you want 
> to go to a particular index, look it up in the array and go to that 
> card ID.
>
this might be something to look into.  it would be essentially what I 
am doing now on each "re-order" command, but would keep from having to 
do the search each time.  This seems awkward though to have to create 
and manage a separate array just to access custom properties - rather 
than access them directly.  I guess though that custom properties 
aren't really equals in Transcript terms to native properties.  (short 
name, card ID, etc... ) this is unfortunate.

Actually Ken's response is probably the simplest answer for doing what 
I want to do.  It is halfway between what I want to do and your 
methods.  There are just so many ways of doing things in transcript!

Thanks very much!
Chris



More information about the use-livecode mailing list