• 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

find method from database side in B&S

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

Hi All,
find method is given like this in instruction:
// 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)



Here I am talking about search from database side not from User Interface

I implemented find method like this way:

If user will specify criteria array like this

criteria[0]="SubContractor name";
criteria[1]=null
criteria[2]=null
criteria[3]=null
criteria[4]=null
criteria[5]=null


then find method will return record number array of those records those are matches with criteria[0]="SubContractor name"
since only criteria[0](sub contractor name ) is specified.

If user will specify criteria array like this

criteria[0]="SubContractor name";
criteria[1]="city"
criteria[2]=null
criteria[3]=null
criteria[4]=null
criteria[5]=null


then find method will return record number array of those records those are matches with this condition (criteria[0]="SubContractor name" OR criteria[1]="city")
since only criteria[0](sub contractor name ) and criteria[1](city) are specified.


If user will specify criteria array like this

criteria[0]="SubContractor name";
criteria[1]="city"
criteria[2]="services"
criteria[3]=null
criteria[4]=null
criteria[5]=null


then find method will return record number array of those records those are matches with this condition (criteria[0]="SubContractor name" OR criteria[1]="city" OR criteria[2]="specialities")


so on.

It is like OR condition of criteria string array elements.

is it okay?

Regards
Pramod

 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Pramod!


It is like OR condition of criteria string array elements.

is it okay?



That's exactly it!
 
reply
    Bookmark Topic Watch Topic
  • New Topic