looking for a smart approach to "sort" an array

Bob Sneidar bobsneidar at iotecdigital.com
Fri May 5 11:37:06 EDT 2017


I read your post a bit closer. Can you just repeat for each line tLine in tText, then increment a counter and use the counter as the key in the array? 

Bob S

put "Bob" & cr & "Andy" & cr & "Fred" into tText
repeat for each line tWord in tText
add 1 to tCount
put tWord into myArray [tCount]
end repeat


> On May 5, 2017, at 07:52 , Mike Bonner via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Bob, can you do a custom sort using order by with sqlite?  I did some
> digging and see a way, but for this purpose it seems complicated and I'm
> wondering if there is something better than what I found. Basically what I
> found was this..
> 
> ORDER BY
>  CASE ID
>    WHEN 4 THEN 0
>    WHEN 3 THEN 1
>    WHEN 1 THEN 2
>    WHEN 5 THEN 3
>    WHEN 6 THEN 4
>  END
> 
> So to my thinking one would build a large "order by" with all the
> words and their associated line numbers so you could do
> 
> WHEN 'myfirstword' THEN 0.. etc for each word and its line number in
> the list.  (Always interested in new ways)





More information about the use-livecode mailing list