What I would like to do is for every distinct value encountered in the first column, create an object and set an array/vector of size equal to the number of values in the second column associated with that first column value. For example, an object called 'D43_object' that has a vector of size 3 containing the 3 ids associated with cfcc 'D43'. My attempt at coding this is as follows:
I know why my code does not work but I do not know how to go about altering it so that objects are instantiated correctly and how I can create new objects only for certain rows in the result set and not for every row in the result set. Can anybody show me how I might fix this. Thnaks a lot, Joe
Have you considered the idea of using a Hashtable with cfcc as the key and the vector of Ids as a value? This way you don't have to worry about the order of the the cfcc's being returned and I think you'd have to do less checking.
Joe, Make sure you have an order by clause in your SQL statment so the cfcc's are returned in order.
The idea looks fine. Although "that has a vector of size 3 " is more of an implicit requirement. You will wind up with a Vector with three elements in it. But you don't need to know there are three before you start out.
The only thing I don't see is the collection you are storing all the LayerFeature objects in.
Hi Jeanne, Denise. Thanks a lot for your replies. Denise, I have not tried using Hsahtables just yet but I may use them in the future. Jeanne, I did as you suggested but I am still encountering the following error:
variable landmark_ids might not have been initialized
The code is as you specified:
Its kind of like the error I had initially. Have you any ideas. Cheers, joe