wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes My idea about get field value. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "My idea about get field value." Watch "My idea about get field value." New topic
Author

My idea about get field value.

Leo Tien
Ranch Hand

Joined: Sep 10, 2002
Posts: 156
I use drop down box to support search criteria. So I must get all values of name and/or location field form db.db file. Since this, I think get all values of the others fields too, store them in the memory, such as a Vector. But I afraid if there are a lot of records, this will be a hard work, especially in network environment.
I don't know whether my idea OK? If not, what will I do?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Leo,
The individual records are very small, so you will need to read an awful lot of them in order for it to have an impact on the network (or the network on your application's responsiveness).
But if you were concerned, you could try adding a server side method that only returns unique values for a given column. That way there will be less network traffic.
Personally I don't think you need to worry about this though.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
I used my findByCriteria method put all the individual fields in a TreeSet to sort them and root out duplicates, then used toArray to return an array of Strings. Works Fine.
Tony
Leo Tien
Ranch Hand

Joined: Sep 10, 2002
Posts: 156
Thanks Andrew, thanks Tony.
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Tony,
You wrote:

I used my findByCriteria method put all the individual fields in a TreeSet to sort them and root out duplicates, then used toArray to return an array of Strings. Works Fine.
Tony

I also did it this way except that I didn't use a TreeSet and my drop-downs come out unsorted. I will change my code to use a TreeSet instead. Thanks. By the way, I only refresh the drop-downs (combo boxes) when the user retrieves "all" records with no selection for name or location. Any thoughts on that?
Regards.
Bharat


SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Bharat,
By the way, I only refresh the drop-downs (combo boxes) when the user retrieves "all" records with no selection for name or location. Any thoughts on that?

I understand that your search criteria comboBoxes need some "refresh" functionality (records may be created, updated or deleted by another application with as consequence that your criteria values are not up to date anymore). But why to couple it with the "search all" function ? I don't see any logical relation between both events (the user deciding to retrieve all records, and the need to refresh the search criteria). Did I miss something ? If not, I think that some "refresh" button could do the job.
Best,
Phil.
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Phil,
You wrote:

I understand that your search criteria comboBoxes need some "refresh" functionality (records may be created, updated or deleted by another application with as consequence that your criteria values are not up to date anymore). But why to couple it with the "search all" function ? I don't see any logical relation between both events (the user deciding to retrieve all records, and the need to refresh the search criteria). Did I miss something ? If not, I think that some "refresh" button could do the job.

Thanks for your response. I wasn't really sure what should I do. I figured if I let the user retrieve all records whether they are booked or not (except the deleted off-course), and refresh the combo-boxes at the same time. Why not? Saves me a "Refresh" button. Moreover, do the specs say otherwise? I am not sure. You may be right.
Regards.
Bharat
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Bharat,
I think that the CSR's will use at least the "location" search criteria most of the time. If they don't find a room to book for a specific location, and if (we don't know from our instructions how/when new records are added to the db) they know that new records may be added while they are working, they'll want sometimes get a "fresh" list of search criteria values. If the only way you offer them to achieve that is to query the db for all records (which they don't need BTW), I am not sure they'll find it user-friendly. Just try to explain that in your user manual and ...
In theory, the best solution IMO is to get the criteria values automatically updated as needed, but, after analysis, I found it too complex to be implemented.
if I let the user retrieve all records whether they are booked or not (except the deleted off-course)

How do you justify the fact that you show booked rooms along with bookable ones ? After all, the CSR's job is just to book rooms, and the latter must be available for booking.
BTW, did you take into account the 48 hours restriction ?
In my implementation, I will show only rooms available for booking. These are :
  • Not deleted
  • Not booked yet
  • With a date which is neither past nor outside the 48 hours time range


  • I intend to make that range parametrable.
    I wondered if some "unbook" function had some sense (which would justify the fact that the user may see booked rooms), and my conclusion was that it is not a good idea. On the other hand, I think that some "undo" function is more interesting : a user would be able to unbook a room booked by him, as far as it is still "undoable" (operation still in some fixed-size "undo" buffer maintained server-side and the record(s) envolved didn't change in the meantime). When the user would call undo, he'll have to select which operation(s) to undo within a list and confirm it. What do you think about it ?
    Regards,
    Phil.
    [ September 07, 2003: Message edited by: Philippe Maquet ]
    Bharat Ruparel
    Ranch Hand

    Joined: Jul 30, 2003
    Posts: 493
    Hello Phil,
    Thanks for the response and sharing your thoughts. I will think it over and get back to you by tomorrow.
    Working late tonight in France? It is 4 PM here in Boston.
    Regards.
    Bharat
    Philippe Maquet
    Bartender

    Joined: Jun 02, 2003
    Posts: 1872
    Hi Bharat,
    It's 10 PM here in Brussels (BTW I am in Belgium, not France - OK it's very close, anyway much closer than Boston to India where I imagined you were living ). I'll stop working for today. "See" you tomorrow then.
    Best,
    Phil.
    Tony Collins
    Ranch Hand

    Joined: Jul 03, 2003
    Posts: 435
    But is that French brussels or Dutch brussels ?
    I've heard they don't mix.
    Tony
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: My idea about get field value.
     
    Similar Threads
    Doubt in Calendar.get(int field)
    updating a primary key field
    B&S 2.2.2 updateRecord()
    how to get static members of a class
    Send Form info