Page 1 of 1

Sorting a field

Posted: Sun Mar 02, 2008 12:15 am
by EzCoder
Hello,
After trying several approaches, I just can't seem to see what I'm doing wrong. The goal is to sort the lines in a certain field by the first Item, then copy the data over into a second field. Copying the data from one field to the other works without problem, so maybe someone can shed some light on what I need to be doing to make the sort work. Here's some sample code:

Code: Select all

on mouseUp
  sort lines of fld "field one" by Item 1
--  repeat for each line thisLine in field "field one"
--    put thisLine &cr after field "field two"
--  end repeat
end mouseUp
Thanks,
EZ

P.S. I've read the documentation and Dan's book enough to confuse myself.

Posted: Sun Mar 02, 2008 12:20 am
by BvG
almost there:

Code: Select all

sort field "field one" by item 1 of each

Posted: Sun Mar 02, 2008 12:24 am
by EzCoder
...of each
Aha! ...not I understand the somewhat cryptic error message I kept getting as well. :)

Thank you so much!

EZ

Posted: Sun Mar 02, 2008 12:54 am
by EzCoder
That works well. :)

Along the same line of thought, other than the available RAM, is there a functional limit to the number of items that can be sorted in such a manner?

I've been testing with sample data ranging from just a few lines to over 5000 and it seems that the larger numbers won't allow the screen to refresh/redraw itself if trying to interact otherwise. (application turns white if you click on anything until it is finished)

Is there a proper way of using "wait with messages" in this situation?

Last set of questions for awhile I think. :?

EZ