This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

GUI exact match on searching

 
Ranch Hand
Posts: 92
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

so in my B&S assignement there is a requirement;

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

but the DB interface also specifies;

// 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);

Now at the moment my GUI will return results as per the find specification, so if you enter "Fred" as the contractor name you'll get back results where the name is "Freddy". Am I right in thinking that this does not meet the above requirement? Furthermore, am I right to assume that the search should be case sensitive?

Regards,

John
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

"Fred" should only return these records with name = "Fred" (not "Freddy" nor "Fredi"). The find-method of your Data class should return the records with name = "Fred", "Freddy" and "Fredi". So at the GUI (or business service) some "exactly matching" filtering is required.

I decided to implement a case-insensitive search in Data class and business service, but that is not a requirement. I explained also in choices.txt why I chose this approach.

Kind regards,
Roel

 
John McParland
Ranch Hand
Posts: 92
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel,

that's what I thought I'd do (albeit belatedly..)

Regards,

john
 
Oh. Hi guys! Look at this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic