Re: sorting SQLite keys where no leading zeros at end of name

2015-06-04 Thread Peter Haworth
If the text and numeric portions of the key are indeed separated by an underscore, the following should work as an ORDER clause (untested). ORDER BY substr(TheKeyColumn,1,instr(TheKeyColumn,'_')-1) ASC,CAST(substr(TheKeyColumn,instr(theKeyColumn,'_')+1) AS INTEGER) ASC If there are a fixed

sorting SQLite keys where no leading zeros at end of name

2015-06-04 Thread Dr. Hawkins
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,

Re: sorting SQLite keys where no leading zeros at end of name

2015-06-04 Thread Mike Bonner
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

Re: sorting SQLite keys where no leading zeros at end of name

2015-06-04 Thread Mike Bonner
oh duh. Ignore me. My answer sorts them after the fact with lc. Peters answer does the same basic thing inside sqlite. On Thu, Jun 4, 2015 at 5:07 PM, Peter Haworth p...@lcsql.com wrote: If the text and numeric portions of the key are indeed separated by an underscore, the following should

Re: sorting SQLite keys where no leading zeros at end of name

2015-06-04 Thread Dr. Hawkins
On Thu, Jun 4, 2015 at 4:07 PM, Peter Haworth p...@lcsql.com wrote: ORDER BY substr(TheKeyColumn,1,instr(TheKeyColumn,'_')-1) ASC,CAST(substr(TheKeyColumn,instr(theKeyColumn,'_')+1) AS INTEGER) ASC If there are a fixed number of chars before the numeric part of the key, then you can replace

Re: sorting SQLite keys where no leading zeros at end of name

2015-06-04 Thread Peter Haworth
Let me know if it works. I might have the wrong number of prans, etc but the theory should work. Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Thu, Jun 4, 2015 at 4:12 PM, Dr.