This week's book giveaway is in the Design forum.
We're giving away four copies of Experimentation for Engineers: From A/B testing to Bayesian optimization and have David Sweet on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

SQLite ordering

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a table that i currently use to fill a spinner with in alphabetical order, i was wondering if there was a way where i could set a certain row as always top then order the rest below it in alphabetical order?



thats the code im currently using
 
Saloon Keeper
Posts: 26769
190
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what you actually want to do is pre-select a certain item in your spinner. Yes, you could arrange the data in broken alphabetical order, but it's a lot of work and it's likely to confuse the user. So instead of doing database tricks, I'd recommend that you simply pre-select the spinner to the preferred value.
 
adrian rowlands
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ye I can do that but I have an show all option in the spinner and id like that to always be first so the user doesn't have to go search for this
 
Tim Holloway
Saloon Keeper
Posts: 26769
190
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably the easiest thing to do then, would be to take the List of returned items, remove the preferred element from the list and re-add it to the top. Doing it in SQL is an ugly process and I'm not even sure SQLite's SQL capabilities extend to some of the features required.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic