• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S - find criteria

 
woo sung
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to make sure about discussion "B&S - serching" below.
I am doing B&S 2.1.1.

I have
"public int[] find(String[] criteria)."

And I have a sentese in The User Interface specification:
"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."

In the DB schema, name is first field and location is second field.

Therefore, can i call find method like :
String[] criteria = new String[];
criteria[0]="fred";
criteria[1]="adel";

int[] returnResult = DBImp.find(criteria);

and result will have int array of record numbers matching the value in name field( i.e both of "fred" and "freddy") and/or match the value in location (i.e both of "adel" and "adelaide")

Am i right?

another question is about "AND/OR" in "where the name AND/OR location fields exactly match values specified by the user."

I have no idea how i can make code "name and location" and "name or location".
if i pass the criteria array value below

String[] criteria = new String[];
criteria[0]="fred";
criteria[1]="adel";
criteria[2]="and"; or criteria[2]="or";

do you think it will be fine?
 
Macy
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my program, I use the following:

Name only:
criteria[0] = "fred";
criteria[1] = ""; (Any in my GUI)

Location only:
criteria[0] = ""; (Any in my GUI)
criteria[1] = "atlantis";

Name & Location:
criteria[0] = "fred";
criteria[1] = "atlantis";

each values use for one column. First value for first column, ... null values will return all records.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic