• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

URLyBird Search Options

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The requirements of the user interface state 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."

Would it be enough to have the search return all records when no criteria is specified or does there need to be an explicit option to return all records such as having another button that says "List All"?

Also, I noticed that there are a bunch of different versions of the URLyBird assignment floating around out there. Are these given out at random or does it depend on the time that you buy the assignment? Mine is 1.1.1

Thanks

Jason
 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, what is "URLyBird assignment", I remember my assignment is FBN, something like air ticket ordering system.

Thanks
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jason Nesbitt:
The requirements of the user interface state 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."

Would it be enough to have the search return all records when no criteria is specified or does there need to be an explicit option to return all records such as having another button that says "List All"?

Also, I noticed that there are a bunch of different versions of the URLyBird assignment floating around out there. Are these given out at random or does it depend on the time that you buy the assignment? Mine is 1.1.1

Thanks

Jason



Someone else correct me if I am wrong, but I believe what it is saying, is that, if the search field is empty and the user hasn't entered a search string, all of the records should be displayed.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats what I believe also. I dont think you need to list all records button. I have the URLyBird assignment as well.

However,

In the DBAccess interface, under findByCriteria, the comments for it say...
"Field n in the database file is described by criteria[n]. A null value in criteria[n] matches any field value."

I'm confused, do we need to implement every record value is matching that in criteria or can we just implement it so a record value matches the name and location in the criteria?
[ November 11, 2004: Message edited by: Sean Gildea ]
 
Daniel Simpson
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sean Gildea:
Thats what I believe also. I dont think you need to list all records button. I have the URLyBird assignment as well.

However,

In the DBAccess interface, under findByCriteria, the comments for it say...
"Field n in the database file is described by criteria[n]. A null value in criteria[n] matches any field value."

I'm confused, do we need to implement every record value is matching that in criteria or can we just implement it so a record value matches the name and location in the criteria?

[ November 11, 2004: Message edited by: Sean Gildea ]



I've started to ask this same question in the past week. Currently, my search method in my Data class is only programmed to search for a contractor name and location, nothing more. Would I fail the assignment if they felt that I didn't implement the method correctly?
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you would fail the assignment, but it wouldn't surprise me if you lose some points. I have the B&S assignment, and it has a similar findByCriteria(String[] criteria) method. Even though the client will only have the ability to search by Name or City, my method has the functionality to search by any field, or combination or multiple fields. I think this falls under the "future functionality enhancements" clause in the instructions:

Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a framework that will support this with minimal disruption to the users when this occurs.

However, it does not say must anywhere, so I doubt it would be an automatic failure.
 
Daniel Simpson
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Bourdeaux:
I don't think you would fail the assignment, but it wouldn't surprise me if you lose some points. I have the B&S assignment, and it has a similar findByCriteria(String[] criteria) method. Even though the client will only have the ability to search by Name or City, my method has the functionality to search by any field, or combination or multiple fields. I think this falls under the "future functionality enhancements" clause in the instructions: However, it does not say must anywhere, so I doubt it would be an automatic failure.


I'm having trouble interpreting the Javadoc for that findByCriteria method. Could you give me a skeleton or some pseudocode with how you approached the issue?
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I did is implement the find method the way the included comment says it should be implemented, in that I can search on any field or combination of fields based on the criteria using the startsWith method. However, my requirements state that I can search on the Name and Location fields using the criteria and that the criteria must EXACTLY match the values stored in the record. Therefore, after some researching on this matter using this forum, the ideal solution for me was to use JComboBoxes which are populated with valid values. However, should the developer of the client wish to allow searching on part of a field, then they could do that in the future without any changes needed for the find method.
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a drop boxes with the all option , and options for selecting the different choices in the database. I also had clear buttons so that user could clear the fields, and the blank fields did an all search as well, as the requirements stated. In this way the user could either chose the different options or type in the search and the program would perform and exact match. I thought the exact match requirement screamed for a drop box so I put one in. I got full marks for the GUI with my approach, you should add what ever feature you think will help the user, just dont over complicate it.
[ January 07, 2005: Message edited by: Inuka Vincit ]
 
Daniel Simpson
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Inuka Vincit:
I had a drop boxes with the all option , and options for selecting the different choices in the database. I also had clear buttons so that user could clear the fields, and the blank fields did an all search as well, as the requirements stated. In this way the user could either chose the different options or type in the search and the program would perform and exact match. I thought the exact match requirement screamed for a drop box so I put one in. I got full marks for the GUI with my approach, you should add what ever feature you think will help the user, just dont over complicate it.

[ January 07, 2005: Message edited by: Inuka Vincit ]


Thank you both for responding, Eric and Inuka. I, too, took that approach with the GUI and made JComboBoxes, one populated with Contractor names and another populated with Contractor locations. My question, though, was aimed more towards the search method itself in the data class. Here is what the Javadoc says for the find method:

// 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".)


Currently, my search method is completely based on searching for a contractor name and/or location, and I know that I will probably get points off because you cannot search for anything besides those. I am having a brain lock where I cannot figure out how to implement the method given the comments listed above. So would the criteria always be an array that has a length of 6? Such as:

Is that correct? Say someone wanted to search by contractor name and price. Would the String array be:

That doesn't seem right because according above, it would match all of the values for location, etc. because they are all null. Am I completely missing something? Help!
 
Inuka Vincit
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No each field of the array corresponds to a column in the table. So that way it wont display all the fields

for example

to search java hilton
this is an example from my head carnt remeber what the specs said

search[0] = null //corresponding to rooms
search[1] = null //corresponding to date
....
search[4]= "java" //correspons to location column

...
search[5]="hilton" //correspons to name column

I think your thinking its search[0] or search [1] or .... search[5] type of thing. Rather its name== search[5] and location ==search[4] and ... search[0]== rooms type of thing(conceptually). Hope I dont sound confusing.... thats how I did the implementation and interpreted the requirements. Otherwise yes the search would be meaningless
[ January 08, 2005: Message edited by: Inuka Vincit ]
 
Daniel Simpson
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Inuka Vincit:
No each field of the array corresponds to a column in the table. So that way it wont display all the fields

for example

to search java hilton
this is an example from my head carnt remeber what the specs said

search[0] = null //corresponding to rooms
search[1] = null //corresponding to date
....
search[4]= "java" //correspons to location column

...
search[5]="hilton" //correspons to name column

I think your thinking its search[0] or search [1] or .... search[5] type of thing. Rather its name== search[5] and location ==search[4] and ... search[0]== rooms type of thing(conceptually). Hope I dont sound confusing.... thats how I did the implementation and interpreted the requirements. Otherwise yes the search would be meaningless

[ January 08, 2005: Message edited by: Inuka Vincit ]


I'm still a bit confused, I almost may need some sort of code snippet to grasp what you are trying to explain by your implementation. Here is my currently incorrect implementation of my find method:


I hope my incorrect implementation can help you understand how I am interpretting it incorrectly so you can help me. Thanks, Inuka!
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got a question regarding the omnipotent JComboBox. Do you guys perform a search everytime the JComboBox is touched before the values are displayed?

I'm just worried that otherwise the JComboBoxes wont have the latest data.

Thanks /Dave
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Daniel,
I think its best to simply compare the two String arrays without thinking about which field is what. Like in this method:

You could use something like this in your findRecords method. A criteria example for name and location would be {"name", "location", null, null, null, null}. Then if you later decide you want to add search functionality for other fields, you won't have to change this code.
 
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Jason! Not related to your question but perhaps useful... When searching for all records, I sent only the null parameter, if I remember correctly, as the array; this allowed me to short looking for all records and made their retrieval much faster than if i sent an array of nulls.
 
Daniel Simpson
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You could use something like this in your findRecords method. A criteria example for name and location would be {"name", "location", null, null, null, null}. Then if you later decide you want to add search functionality for other fields, you won't have to change this code.[/qb]<hr></blockquote>

Matt, thanks that helps. I was totally making it much harder than it should be and I implemented it correctly now. Anton, your idea of passing a null array sparked an idea. Thanks!
[ January 08, 2005: Message edited by: Daniel Simpson ]
 
Daniel Simpson
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Abramowicz:
I've got a question regarding the omnipotent JComboBox. Do you guys perform a search everytime the JComboBox is touched before the values are displayed?

I'm just worried that otherwise the JComboBoxes wont have the latest data.

Thanks /Dave


Hey, Dave. I'm not exactly sure what you are asking. Let me try to answer my best of what I think you are trying to say. I have B&S and my specs says that it should allow a client to search for a contractor name AND/OR a location. I only have 2 JComboBoxes, one for names and the other for location. I am using a cache for my records, so at startup, my records are cached and the JComboBoxes are populated. I decided that repopulating the JComboBoxes after every call to update would require a pretty extensive algorithm the way I implemented. I decided that it is past the scope of the assigment since the only thing that is changing are the booked fields, nothing else. Another possible answer to your question, a client can select either name and location, or they can do both or leave both empty. When they hit search, a search is performed first on the server side to return wild card values (startswith) and then in my Controller in the GUI, the results are sorted again using .equals(). I hope that helps!
 
David Abramowicz
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That was exactly my concern, your first answer. So if contractors or locations are added during execution they will not appear in the JComboBoxes.

Hmm... I wonder if I'm happy with that, although I see your "past the scope of this assignment" argument.

Cheers /Dave
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Matt Sheehan.:


Have you thought about not using like so, this would be the more common idiom:

 
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic