• 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

NX: URLYBird - Use of findByCriteria(String [ ])?

 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Actually I posted this in a different thread, but thought it is not relevant to that and so starting as the new thread(Am gonna delete it there).
I am having difficulty in understanding the reason for the existence of findByCriteria() method.
Instructions given by the Sun are as follows. 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. This is the instruction in "The User Interface" section.
As there is "or" in the requirement, we can just provide search for the name/location fields and not all the fields. Here they have mentioned strictly by specifying "must" and so we must exactly match like George and others said, case sensitive too.
And again, the findByCriteria() is given by
// 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 long[] findByCriteria(String[] criteria);
Is this the function we are supposed to implement to get the search results for the requiement mentioned in "The User Interface" section? If so, there is some deviation right? I mean, this function should return like say for Fred, anything that starts with Fred like Fredo, Freddy.
Or are we supposed to implement the search requirement for the "The User Interface" section in a different funtion? If so, I do not see the need for findByCriteria() method. Please correct me if I'm wrong.
Appreciate your help, thanks.
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Satish,
About the apparent and/or and and exact/partial matches apparent contradictions in searching, I suggest you to read the two threads below (and possibly the links included):
https://coderanch.com/t/184550/java-developer-SCJD/certification/NX-Search-Criteria-GUI
https://coderanch.com/t/184754/java-developer-SCJD/certification/NX-findByCriteria
Don't hesitate though to go on asking questions in this thread is something looks still unclear after reading.
Regards,
Phil.
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Phil. I have gone through the threads once, but could'nt understand them. I will go through them for a couple of more times (or more) and if I still have any doubts, I will post it there as it will be more appropriate there.
Appreciate your help. Thanks.
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Phil, I got it now. Thanks.
 
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic