sorting SQLite keys where no leading zeros at end of name

Mike Bonner bonnmike at
Thu Jun 4 18:52:32 EDT 2015

You can do this.

on mouseUp
-- my field has sample data based on your example
   put field "myfieldWithData" into tData
   sort lines of tData ascending numeric by numberTag(each)
-- tData now contains your sorted keys, do with them as you wish.
end mouseUp

function numberTag pVar
-- returns the number portion of the line as the sort key
   return char (offset("_",pVar) + 1) to -1 of pVar into tTest
end numberTag

On Thu, Jun 4, 2015 at 4:36 PM, Dr. Hawkins <dochawk at> wrote:

> I have keys that get generated such as
>    someKey_1
>    someKey_2
> I just hit the snag that someKey_10 comes between the two of these.
> Is there a clean way to get SQLite (in memory) to ORDER these numerically
> without having to recode to force leading zeros?
> *yuk*
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

More information about the Use-livecode mailing list