How to group strings by prefix

Posted by namenlos on Stack Overflow See other posts from Stack Overflow or by namenlos
Published on 2010-04-08T09:27:55Z Indexed on 2010/04/08 9:33 UTC
Read the original article Hit count: 499

Filed under:
|
|

I am writing a Winform UI in which the user must select a single customer. (For reasons beyond my control I am limited to a UI that uses dropdown lists, text fields, checkboxes, radiobuttons only -i.e. no fancy special UI controls)

The situation

  • There are a lot of customers (a thousand for example)
  • If i put all the customers in a single dropdown there's no way it will be easy for a customer to even see all the customers. Also the it will take too long to retireve all the customers from the DB to populate the dropdown
  • My thought is to have two combo box, the first lists groups of the customers by their last name something like a phone book "Aa-Ac", "Ad-Ade", "Adf-B", when selecting the first combo box, it scope the second one to a managable set customer names (no more than for example 40 names)

The question

  • I need a reasonable way of grouping their names such that it will be clear to customer which group contains the name. I.e. given a group of names I need to bucketize then int "Aa-Ac".

Comments

  • I don't need to solve the general problem of an immense number of names - we know based on our data that 1000 names is the max our users will encounter.
  • If there are other techniques please do share, but I am interested specifically in an answer to my specific question around how to determine the buckets ("Aa-Ac", etc.)

© Stack Overflow or respective owner

Related posts about grouping

Related posts about names