This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

A null value in criteria[n] matches any field value  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI guys.

I�m a little confused with the requirements of the find() method, it says �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".)�

It means that if there is a null value in the criteria all records will be return? Because a null value matches any field value:

Criteria = {�Fred�, null, null, null, null, null} returns all records because of the nulls or it just returns records that starts with �Fred�?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alejandro

I'm not sure it you have the same sun instructions as myself, but the following was a criteria for the UI....

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

So the only fields your are required to search on are name and location.

So if you have criteria{"Fred",null} then all contractors who name begins with fred in all location will be returned.

If you have criteria{null,"Smallville"} then all contractors in location smallville will be returned.

Hope this helps
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Alejandro,

I think the key is the assignement sentence "A null value in criteria[n] matches any field value". In my opinion, this statement stands for the
field[n] only. Having a null value at criteria[n] doesn't mean
the result is the whole database, it does just mean that there is no
filtering process to do on the records field[n].

Hope this help

Gilles
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!