• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Filter on multiple Key values in a JTable

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic