Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Filter on multiple Key values in a JTable  RSS feed

 
Jason Richard
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm working on something and I am unsure how to approach a solution.

I have working solution for filtering a table. However I want to use the filter results of that table to filter a different table.

if My first table looks like this:

JOHN PLUMBER
MIKE PLUMBER
MARY CARPENTER
SALLY CARPENTER
BOB SOLDIER
JUAN DENTIST




If my first filtered table gives me the following results (based on other columns):

JOHN PLUMBER
MARY CARPENTER
BOB SOLDIER


I want to be able to use this pairing of key fields to filter a different table, so if my second table was


JOHN PLUMBER MANCHESTER
JOHN PLUMBER CONCORD
MIKE PLUMBER CONCORD
MARY CARPENTER SMITHFIELD
SALLY CARPENTER GREENFIELD
BOB SOLDIER IRAQ
JOHN DENTIST SPRINGFIELD

my filtered results end up being

JOHN PLUMBER MANCHESTER
JOHN PLUMBER CONCORD
MARY CARPENTER SMITHFIELD
BOB SOLDIER IRAQ


I get how to do this for one column. I could make it so if I wanted to filter for "CARPENTER" I get all the CARPENTERS. I can also make if I want all the PLUMBERS named JOHN , i get the one result.

What I don't understand (hence I'm not adding PSUDO-code) , is how i can filter on the Forgegn Key Pair (or maybe more columns)

So I'd want from the second table is all the Records that have

"JOHN + PLUMBER"
"MARY + CARPENTER"
"BOB + SOLDER".

This would bring back four rows in the table. I don't want Mike because even though he's a PLUMBER he's not a result of the original filter. (which perhaps was filtered on zip code and years of service which are unrelated to the second
table.

I hope I am explaining this well. If I'm still being confusing let me know. In the end I want to use the list of key pairs to filter a different table only for those matching key pairs.
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- no idea, there isn't issue in logics, everything depends of code, logics for RowFilter, value stored in both XxxTableModels

- for better help sooner post an SSCCE, short, runnable, compilable, with hardcoded value for XxxTableModel in local variable,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!