It's not a secret anymore!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Searching Criteria - GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Searching Criteria - GUI" Watch "Searching Criteria - GUI" New topic
Author

Searching Criteria - GUI

Amit Johar
Greenhorn

Joined: Jan 12, 2006
Posts: 3
Hello,
I have problems understanding the search criteria (URLyBird Assignment)
"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."

What does this exactly mean??

According to what i understand
"Must allow the user to search the data for all records" means
The user should be able to search for a subset of all records using differen search criteria e.g. Name = palace, Smoking = yes , Room = 2 will return subset of record with name = palace, smoking = yes and room=2 (max occupancy)

what does "or for records where the name and/or location fields exactly match values specified by the user." means???
Pawel Poltorak
Ranch Hand

Joined: Sep 21, 2005
Posts: 36
Hi,

I understand it as follows:

"Must allow the user to search the data for all records"
You must give user means to enter such criteria which will select all records.

"or for records where the name and/or location fields exactly match values specified by the user."
You must give user means to enter certain location, name and specify if both values must satisfy criteria to accept the room (which is equivalent for AND operator), or only one value must satisfy criteria to accept the room (which is equivalent to OR operator).

Also, bear in mind that we have to search for EXACT criteria, and in Data.find method algorithm should accept records which START with criteria. So Data.find can return more records than it is required and they should be filtered.

Hope this helps,
Pawel


SCJP, SCJD
Bridget Kennedy
Ranch Hand

Joined: Nov 30, 2004
Posts: 84
Also, bear in mind that we have to search for EXACT criteria, and in Data.find method algorithm should accept records which START with criteria. So Data.find can return more records than it is required and they should be filtered.


I provided a simple way in the gui for the user to choose "begins with" or "exact match" search type.
Henrik Strand
Greenhorn

Joined: Jan 05, 2006
Posts: 20
Hi!

"Must allow the user to search the data for all records"


Doesn't that mean that there should be a way for the user to, for example, press a button "get all records" which will return all records from the server and show them in the client GUI without asking the client user for any search criterias?

Regards,
Henrik
Amit Johar
Greenhorn

Joined: Jan 12, 2006
Posts: 3
Hello,

My comments in BOLD

"Must allow the user to search the data for all records"
You must give user means to enter such criteria which will select all records.
Does it mean we can provide a Button On GUI which says "All Records" and all the valid records are displayed


"or for records where the name and/or location fields exactly match values specified by the user."
You must give user means to enter certain location, name and specify if both values must satisfy criteria to accept the room (which is equivalent for AND operator), or only one value must satisfy criteria to accept the room (which is equivalent to OR operator).
"Means we just need to provide(Minimum) two search field to user( Name and Location)"


Regards
/Amit Johar
Pawel Poltorak
Ranch Hand

Joined: Sep 21, 2005
Posts: 36
Hello,

I provided two editable combo boxed (name and location) and radiobuttons Match all fields/Match any field (and/or option). Additionaly each combo box has a special value 'Match all records' which, if chosen, will accept all values of certain field.

Best Regards,
Pawel
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi everyone,

Interesting discussions. However I think that some of the possibilities may be a little over complicated. So I am going to make some comments about things that have worked in the past, which may (or may not) be less complicated. That does not mean that your solutions are wrong, nor that they should be discarded. However I thought that if you see what others have done you might think about how you can simplify your own solutions.

I have seen many candidates getting full marks for using two combo boxes for the two search fields, the combo boxes populated either from specific calls to the server, or by parsing the initial data from the server (where all data is displayed on the initial screen). If you were doing this, then the combo boxes might have an "any / all" type of field, or you might choose to have a separate button that allows searching for all criteria (but if the latter, then you would probably want to have some way of "selecting" a blank entry in your combo box anyway. A picture is worth a thousand words, so here is an example:



Some of the advantages of this is that the user cannot enter incorrect data, and it does go a long way to meeting the criteria that exact matches must be displayed in the GUI.

Of course there are more powerful solutions - one we used in both the SCJD books was to allow the user to enter a regular expression for searching the database. This is extremely powerful (and something that is worth while looking at if you have not already used it), but far more prone to user error / confusion.

As for the instruction
From the instructions:
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 think that this is poor use of English (however this may be intentional - Sun have specified that some instructions are deliberately confusing (and may contradict other instructions - did you find such instructions ) just so they can see that you can handle such problems on your own).

However one possible interpretation that does meet the requirements is:
  • The user can search for all records (a standard search that does not enter any criteria should do this - or in the case of the combo boxes having an "any / all" type of option.
  • The user can search for all records where the name and location fields have been filled out (or chosen from the combo box.
  • The user can search for all records where the name or location fields have been filled out (or chosen from the combo box.
  • This interpretation (which is a design choice and would have to be noted as such) fits in well with the possible parameters of the find method in the Data class.

    As I said at the start of this post though: this is just to give y'all things to think about. It is not meant to imply that there is any "one correct way" of doing any part of the assignment (especially not the searching capabilities of the system). But it is worth remembering that you wont get extra marks for making a more complex system .

    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Amit Johar
    Greenhorn

    Joined: Jan 12, 2006
    Posts: 3
    Thankx Andrew For your detail Answer

    I love this forum
    Ali Hussain
    Ranch Hand

    Joined: Jun 19, 2005
    Posts: 211

    However one possible interpretation that does meet the requirements is:

    * The user can search for all records (a standard search that does not enter any criteria should do this - or in the case of the combo boxes having an "any / all" type of option.
    * The user can search for all records where the name and location fields have been filled out (or chosen from the combo box.
    * The user can search for all records where the name or location fields have been filled out (or chosen from the combo box.

    Hello guys,

    I have two text fields (one for location and another for hotel name). If the user has filled both then I search for name AND location. If the user has selected only one of them, then I search only for that one e.g. if the user writes something in the name text field but nothing in the location text field then I search only for the name(my interpretation of OR condition).

    The problem with this approach is that the user must leave one of the fields empty to do an "OR" search. But do you guys (especially Andrew) think that it fullfulls the requirements?


    In addition, I have a button for getting "All database records".
    [ January 17, 2006: Message edited by: Ali Hussain ]

    - SCEA, SCJD, SCBCD, SCWCD, SCMAD, SCJP, ICAD (WebSphere), Lotus Principal CLP, Lotus CLP, Lotus CLS
    Pawel Poltorak
    Ranch Hand

    Joined: Sep 21, 2005
    Posts: 36
    Hi Ali,

    From the instructions:
    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.


    My interpretation of this instructions is that user can enter both name AND location but search for records that match exacly name OR location. I think this way user has much flexible search engine.

    Best Regards,
    Pawel
     
    Consider Paul's rocket mass heater.
     
    subject: Searching Criteria - GUI
     
    Similar Threads
    User Requirement
    search requirement in B&S
    B&S: findByCriteria - pls review
    URLyBird Search all records
    nx: All of URLy Bird 1.1.3 read/write lock(2)