Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!brunix!vali!man From: man@vali.cs.brown.edu (Mark H. Nodine) Newsgroups: comp.sys.mac.hypercard Subject: Re: Sorting by multiple fields Message-ID: <48994@brunix.UUCP> Date: 4 Sep 90 17:12:00 GMT References: <1609@luth.sm.luth.se> <41691@sequent.UUCP> <1990Sep3.140709.16158@uncecs.edu> Sender: news@brunix.UUCP Reply-To: man@vali.cs.brown.edu (Mark H. Nodine) Organization: Brown Computer Science Dept. Lines: 26 In article <1990Sep3.140709.16158@uncecs.edu>, dlugose@uncecs.edu (Dan Dlugose) writes: |>In article <41691@sequent.UUCP> johnv@eng2.UUCP (John VanZandt) writes: |>>I want to sort a stack by multiple fields, with a major and several minor |>>sort fields. How can this be done? |> |>The simplest sort method would be consecutive sort commands in the |>reverse order of importance. For example, if you had a stack of |>student grades in the range A..F, class 1..5 , and you wanted the |>main division to be grades, first all A's, within that sorted by |>class 1..5, within that sorted by last name, this would work: |> |>sort by field "last name" |>sort by field "class" |>sort by field "grade" It is also possible to do the sort in a single command: sort by field "last name" & numtochar(1) & field "class" & numtochar(1) & field "grade" where the numtochar(1) serves as delimiters. --Mark