I know this should be possible, but I'm having a heckuva time getting it to work.

I want to sort some data that looks like this when it comes out of the database, put into variable tRawData (the white spaces are tabs; the random characters are unicode data, waiting to be uniencoded into a field):

26 –±–∞¬¥–±—É—à–∫–∞ grandmother –ë–∞¬¥–±—É—à–∫–∞ –∂–∏–≤—ë—Ç —É –Ω–∞—Å –≤ –∫–≤–∞—Ä—Ç–∏¬¥—Ä–µ. grandma 54 –±—Ä–∞—Ç brother –≠¬¥—Ç–æ –º–æ–∏¬¥ –±—Ä–∞—Ç –∏ —Å–µ—Å—Ç—Ä–∞¬¥. brother 110 –≤–Ω—É–∫ grandson –í–æ—Ç –º–æ–π –¥–µ¬¥–¥—É—à–∫–∞. –°–∞¬¥—à–∞ —Ç–æ¬ ¥–∂–µ –µ–≥–欥 –≤–Ω—É–∫. grandson 111 –≤–Ω—É¬¥—á–∫–∞ granddaughter –ó–¥–µ—Å—å –∂–∏–≤—É—Ç –ö—Ä—É–≥–ª–欥– ≤—ã. –ò—Ö –≤–Ω—É¬¥—á–∫–∞ —ǖ欥–∂–µ –∂–∏–≤—ë—Ç –∑–¥–µ—Å—å. granddaughter 149 –í—Å—ë —Ö–æ—Ä–æ—à–æ,—á—Ç–æ —Ö–æ—Ä–æ—à–æ –∫–æ–Ω—á–∞–µ—Ç—Å—è. All's well that ends well. –í—Å—ë —Ö–æ—Ä–æ—à–æ¬¥, —á—Ç–æ —Ö–æ—Ä–æ—à–æ¬¥ –∫– æ–Ω—á–∞¬¥–µ—Ç—Å—è. Allswellthatendswell 250 –¥–µ¬¥–≤–æ—á–∫–∞ little girl –ú–æ—謥 —Å–µ—Å—Ç—Ä–∞¬¥ –µ—â—ë –º–∞¬ ¥–ª–µ–Ω—å–∫–∞—è –¥–µ¬¥–≤–æ—á–∫–∞. littlegirl 259 –¥–µ¬¥–¥—É—à–∫–∞ grandfather –ú–æ–π –¥–µ¬¥–¥—É—à–∫–∞ —ǖ欥–∂–µ – ∂–∏–≤—ë—Ç –∑–¥–µ—Å—å. grandfather 272 –¥–µ¬¥—Ç–∏ children –ù–∞¬¥—à–∏ –¥–µ¬¥—Ç–∏ –欥—á–µ–Ω—å –±—㬥—Å—Ç— Ä–æ —Ä–∞—ŗǗɬ¥—Ç. children 314 –¥–æ—á—å daughter –≠¬¥—Ç–æ –ù–∞—Ç–∞¬¥–ª—å—è –ò–≤–∞¬¥–Ω–æ–≤–Ω–∞. – õ–µ¬¥–Ω–∞ –µ—ë –¥–æ—á—å. daughter

Another variable, lSortOrder, contains the order I want the lines to appear:

259,26,110,111,272,314,149,250,54

I read the dictionary entry for 'sort container' carefully, and found a couple of sample scripts for similar things from old use-rev postings. This is what I came up with, but it didn't do what I want. I think it boils down to my not understanding how to create custom sort orders.

local lCount,lSortOrder

on updateList
## sort the rawLessonData by item 1 of each line, according to the term list
  put the rawLessonData of fld "vocablist" into tRawData
  put "59,26,110,111,272,314,149,250,54" into lSortOrder
  put 0 into lCount
  sort lines of tRawData by termOrderSort(each)

  -- do stuff with the sorted list
end updateList

function termOrderSort
  add 1 to lCount
  return item lCount of lSortOrder
end termOrderSort

Can anyone advise me?

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to