Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

And/Or search yet again...

 
Roy Mallard
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I just "and" my search criteria together, but I have seen GUI screenshots where people provided a radio button to toggle between "And" and "Or" in the search criteria. Is this really necessary? Has anyone passed without providing that option?
 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I passed without that radio button. I would state that in the choices.txt if I were you.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's nothing in my assignment requiring that.
 
Roy Mallard
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My assignment says:

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.


Since this is a "must" requirement I am nervous about leaving it out, but I don't want to lose marks for my GUI by having a button that noone would ever use. Adding "or" functionality would make my search code a fair bit uglier, since I would have to call my DBMain "find" method multiple times and combine the results.
 
Oliver Weikopf
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting. When I read this bit I thought that "and/or" was there because the user could choose to fill in only one or both fields and the client would search accordingly. So I only do an "and" search. But now I'm no longer sure that's correct...
 
Jimmy Chen
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Oliver Weikopf:
Interesting. When I read this bit I thought that "and/or" was there because the user could choose to fill in only one or both fields and the client would search accordingly. So I only do an "and" search. But now I'm no longer sure that's correct...


that what I think now. Really confusing.

Another one is about the match model: "exact" and "start with" ?

// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria)
throws RecordNotFoundException;


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 searched this site but still can not get the answer.

Can anyone passed give us a definite answer? thanks.
 
Jason Moors
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This was my view on the requirements, hopefully it might help, which I included in my design decisions.

Implementing 'AND' and 'OR' logic in Find method

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.


The distinction I made was that the two requirements are to be implemented in different layers of the application.

i.e You must implement the Data interface and therefore the find method should return the records that start with the search criteria. Thereby keeping the data layer generic and not linked to search for location etc.

However in your business layer you need to implement the business requirement and perform additional filtering of the returned records to ensure they exactly match name/location fields.

Hope it helps

Jason
[ June 30, 2006: Message edited by: Jason Moors ]
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or alternatively (which is what I did) have different filtering options in the data layer which you can supply when performing the search.
That of course means extending the DB interface with some additional methods (which is allowed, as long as the core functionality is also in there).
 
Jimmy Chen
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic