I'm trying to drill into a selection on a swing application. I'm calling the database running a select statement and putting the resultset into a List. From there, I want to get the value in index(3) for each iteration of the List. The problem is, I get only the first value correctly, but not the next iterations...
Can someone please review the code and let me know what I'm doing wrong? Thanks!
CASE_SELECT returns a list with 11 elements per row; if there are 5 rows it will have 55 elements. That's because you add 11 column values per row.
In control_choiceItemStateChanged you keep getting the 4th element of that list. That's always the same.
I see two approaches:
1) Don't add 11 column values per row. Instead, create a new class for containing the values of each row. In CASE_SELECT you then create one instance for each row, and add that instance to the List. In control_choiceItemStateChanged you then get each element of the List, and get the right value from that element.
2) First get the 4th element (get(3)). Then get the 15th (get(14)). Next is the 26th (get(25)). Etc. In other words, increase the index with 11 each time.
Thanks for the tip. Would you mind explaining the first recommendation for me? I'm trying to go that route.. But still no prevail. If I statically call each column needed by adding 11, it works fine. The problem is that the result will change so I need a populated dynamic way to get the 3rd element in each iteration..