using a custom property as a sort key ?

J. Landman Gay jacque at hyperactivesw.com
Sat Feb 28 23:07:10 EST 2004


On 2/28/04 9:11 PM, Christopher Mitchell wrote:

> Howdy,
> 
> Is it possible to use a custom property as a sort key?

You mean, to sort cards?

> I have a stack 
> of flashcards that have an embedded "permanent" order in the form of a 
> custom property called Index.  I use a pretty crude script to flip 
> through all the cards (after being shuffled, aka sort on key random), 
> find the one with index 1, go to it, then sort on it.
> 
> Is it possible to say something like:   go to card with Index of 1

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'".

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)

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.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list