• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

CriteriaFind Confusion

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following question on CriteiaFind method. Help approciated.
1. Does CriteriaFind be Generic or should we do only
Carrier='SpeedyAir',Origin='SFO'" ? I think it should be
generic. But the question is how much generic.
Is the user allowed to enter in the criteria the field name
in any order and in any order. Also user can give some of
the filed names or all of the field names in the criteria.
If so this method becomes very ugly to find out all the field
names and corresponding values and put them in the order that
is acceptable by method find ( or modified version of find
method ). So please give me your advise here.
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The user must be able to search for every field using
an arbitrary combination.
But it is not THAT difficult. My solution took about 50 lines.
Have fun!
 
Raju, Gentle
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marco Barenkamp,
Thanks for the reply. When you say arbitrary combination, does that mean any kind of query should be handled. I can write a
method that can parse the string and arrange them in some order and I can create a method like find and get the results. This will work as long as you use on "filedName=Value" in the criteria string and do not repeat the same filed two time in the query. Also user can enter these fields in all or some and in any order. I can write a method that can handle this requirement.
My Question is: Are we expected to handle
AND, OR < > and etc operators in the criteria String.
For Example:
Origin='DEN' OR Origin='SFO' AND Price > '400' AND Price < 1200.
Queries like this will be very difficult to parse and method requires a lot of intelligence.
You�re Comment please

[This message has been edited by Raju, Gentle (edited September 17, 2001).]
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think handling AND, OR, <> in the criteria String will complicate the matter, and which is not required in the assignment.
I think you should consider only "if the name/order/number of the fields is/are changed" then the method criteriaFind() should handle that without changing the implementation.
According to me this is generic implementaion of criteriaFind().
Pratibha
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have approached the criteriaFind method in the following manner:

  • Parse the criteria into field / value combinations (Utility Class)
  • Locate the position within the datasource for each field being searched. (If there is an invalid field the method returns with null).
  • Search the datasource for the actual value for the associated field.
 
Raju, Gentle
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark, Pratibha, Terry
[This message has been edited by Raju, Gentle (edited September 18, 2001).]
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic