Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Distinct Carrier, Origin and Destination

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,
How did you all tackle the issue of getting distinct carrier, origin and destination on your search gui? Just want to know if this was done on the Data object itself or on the client side?
Thanks
-Amish
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amish,
I did it on the database side.
I don't think you want to modify the Data class itself though, acording to the instructions, this class is "complete".
Regards, Andrew
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So did you use some sort of utility class to do that? Also if you did not do it on Data class how is it working in a network mode?
Thank You!
-Amish
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amish
I should start by saying that I remember one person here saying that they populated the fields with the data that was returned from the initial search - so they did it on the client side.
So did you use some sort of utility class to do that? Also if you did not do it on Data class how is it working in a network mode?

You could extend the Data class to have any additional methods that you like. And then use that extended class in your local / networked solution rather than the Data class itself.
Regards, Andrew
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I put these methods into my DataAccessFacade. In it I would get all the values for a field from all records and loop through them. I would add them to a Collection, if the value was not already in the Collection. This leaves a collection with unique values. I chose the TreeSet for my Collection, however there are other Collections that do not allow duplicates, and if you try to add a duplicate, it will throw an exception.
The chose is up to you on that point, but I think the algorithm is very simple and easy to implement.
Mark
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
Why did you choose to do this on the DataAccessFacade? What was your reasoning?
Also I have created methods like getAllRecords() which returns an array of DataInfo record and getFieldIndex(String fieldName) which given a fieldName it gives the index of that column. These methods are created in the suncertify.db.Data object.
I think my modifying the Data class I am making it more reusable because it should support these basic helper methods.

-Amish

Originally posted by Mark Spritzler:
I put these methods into my DataAccessFacade. In it I would get all the values for a field from all records and loop through them. I would add them to a Collection, if the value was not already in the Collection. This leaves a collection with unique values. I chose the TreeSet for my Collection, however there are other Collections that do not allow duplicates, and if you try to add a duplicate, it will throw an exception.
The chose is up to you on that point, but I think the algorithm is very simple and easy to implement.
Mark
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wake up Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I am actually overly busy at work for months and months and don't get to post as much as I used to.
I chose the Facade, because the Data classes are for dealig with the data. The fact that I need to find Unique values in one particular field, is an application requirement. Not all applications will need that one field unique, or even have that field at all. So I didn't put that into the db package.
In Oracle you create an SQL statement to get your unique values, this SQL statement is not built into the Oracle database when you buy it from Oracle is it? No but it is probably in your application code to get those values to display on a screen.
That is my basic approach as to why it is in the Facade.
Mark
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You very much for your time.
-Amish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic