Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Sorting multiple fields at one time......

From: jfdutcher1958::yahoo::com at: 21-Mar-2006 2:09

The script below works fine ..... and sorts the 'first' of the (4) fields which make up a 'logical' set into order, re-arranging the 'records' in the process. I have tried various options of the 'sort' syntax in trying to get the sort to sort either the first three fields (primary, 1st secondary, 2nd secondary) or, alternatively.....all (4) fields (if the last field is included.....not a problem)....but the Rebol syntax checker doesn't like any of them. Does anyone see the proper syntax to make the sort handle three of the four, or all four fields at once ??? Rebol[Title: "Test Case"] port: open/seek %/c/vetssrc/dietsys/dsysmst.txt read-record: func [port record-size record-number] [ copy/part at port record-number - 1 * record-size + 1 record-size ] substr: func [record offset len] [ copy/part at record offset len ] for i 1 299 1 [ rec1: read-record port 2690 i sortBlock: [] y: 1 regnbr: substr rec1 y + 3 4 lname: substr rec1 y + 7 15 fname: substr rec1 y + 22 15 minit: substr rec1 y + 37 1 if (regnbr <> "XXXX") [ append sortBlock lname append sortBlock fname append sortBlock mold minit append sortBlock regnbr ] ] print sort/skip sortBlock 4 halt