Hello Raffe. I've implemented my criteriaFind in the following way. 1) I pick up the criteria string and pass it to a parse method that uses a string tokenizer to convert the criteria in a DataInfo. 2) Read all the records from the database and compare them with the created DataInfo received from the parse method. This is a special case equals. 3) If the records are equals, I add them to a ArrayList. It's a simple implementation that takes +/- 30 lines of code. Miguel
Joined: Feb 24, 2003
Miguel, that sounds great!
1) I pick up the criteria string and pass it to a parse method that uses a string tokenizer to convert the criteria in a DataInfo.
How do you do that???
Joined: Oct 24, 2002
Hi Raffe. I'm in a hurry now, but your tokenizer can be built to understand =' and like this each two tokens are the field name and the value. Build then a DataInfo with this and return that DataInfo. You have to compare a existent DataInfo with the fields of the Database and insert the tokens in the same position in the new criteria. I've put a post on this I think it was in february. I have to go now. Miguel
Raffe, I edited your post so that the code doesn't make the UBB software look wierd. It happens when a line of code is really long and it distorts the posts. Well, now it looks fine. Most of the time we close threads that have too much code to give away for an implementation of the SCJD assignment. But I am going to let this stay for a day or two so you can get an answer, but then I will need to delete the thread after that time. Mark
I do the following way: Comments are graciously invited. 1) The input is "database index number = value String" delimited by ",". 2) The process is: 2.1) Use one StringTokenizer for delimiter "," 2.2) Use StringTokenizers (for number of key-value pairs) for delimiter "=".
2.3) Search 3) The output is a List. I am yet to implement for "ANY". Rajesh
Sound close Rajesh. what does "database index number " mean? Are you changing the directions for what the criteria string is supposed to look like. They give you explicit instructions on how the criteria string should be, and a number is not it. They want the field name = value string seperated by commas. Good Luck Mark
Originally posted by Rajesh Rajesh: I am yet to implement for "ANY".
My suggestion for "ANY" would be to implement it at the front end.
It doesn't add anything whatsoever to the criteriaFind API; if you want to allow any value for a field, simply don't include it in your criteria!
"ANY" is an English word, and in other languages you'd have to handle it at the front end anyway. Of course we don't do i18n in this application, but it's another hint that this is fundamentally a front-end concern.
It's at least as simple to implement at the client end as at the server.
- Peter [ April 01, 2003: Message edited by: Peter den Haan ]