• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

B&S Searching

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm progressing well with my assignment (B&S v2.1.2) and I'm implementing the user interface for searching.

The assignment specification says that


It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.



I was thinking abut having a a JTextField (or JComboBox, which stores search history) next to a search button. Searching with no text in the JTextField would return all records, entering a value into the JTextField would search on both the name and location fields (ie, if the value entered matches either the name OR location then the record is returned in the search results).

I'm not sure whether that would meet the requirement. The requirement states searching on name and/or location.

The alternative would be to have a search dialog where the user could search on both fields independently. I think this is a bit clunkier for a user interface perspective though.

Anyone got any thoughts on this?
 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Greg,

your last assumption sounds good. I have a search dialog and let the user enter both name and/or location. As soon as the user entered values in both (name and location) you can let him chose between an AND or OR search.

So the logic behind AND and OR search is something you have to implement. Keep care where it says exactly match.

Regards,
Darya
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Greg,

i have also the B&S. I implemented 2 ComboBoxes with the distinct values of the database for each field + a keyword "any".
If the user select both ComboBoxes with a value other than any, than i use AND.
If the user select one ComboBox with a value other than any, than i only search for this value.

I hope, that help you to go further.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One reasonable interpretation of the requirement would be that they have to be able to sort by either NAME or by LOCATION, and you also have to support a search on both NAME and LOCATION. What people keep saying on these forums is that as long as you are interpreting the requirements in a meaningful way, it is OK. So my conclusion is, you can support OR searches if you want to, but you don't have to.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic