[comp.sys.mac.hypercard] Hypercard sorting

pdbourke@ccu1.aukuni.ac.nz (Bourke) (02/26/91)

I have a stack with a number of background fields. Using HyperCard 2.0
how do I sort by more than one field.

ie: I want to do something like
SORT BY BACKGROUND FIELD "TITLE" AND BACKGROUND FIELD "DATE"

If this cannot be done with standard hyperCard where can I get externals 
to do it?

Thanks in advance

dmittman@beowulf.JPL.NASA.GOV (David Mittman) (02/27/91)

I believe that the key to sorting cards by multiple fields is to
perform individual sorts, from the last key to the first key. In other
words, these two sorts are equivalent (except that the first is not
allowed in HyperTalk).

sort cards by bg fld "Test" and bg fld "Junk"

sort cards by bg fld "Junk"  --  Second key
sort cards by bg fld "Test"  --  First key

As always, I could very well be wrong.		- David

kamins@kumr.lns.com (Scot Kamins) (02/27/91)

>how do I sort by more than one field.

HyperCard's sort is stable, so you can sort by both primary and secondary
criteria. The following example produces a stack sorted alphabetically by county
with cities sorted alphabeticaly within counties:

on mouseUp
  sort by field "city"
  sort by field "county"
end mouseup

Hope this helps..

-- 
Scot Kamins         Co-author, "HyperTalk 2.0: The Book"
(415) 282-8872                        (with Dan Winkler)      
671 28th Street            San Francisco           94131
kamins@kumr.lns.com                      kamins@wet.UUCP