Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S Searching

 
Greg Tan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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?
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • 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
 
Bodenstab Oliver
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • 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.
 
Lara McCarver
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic