Filter on detail record values

  • 2
  • Question
  • Updated 5 years ago
I have participants, who have disabilities
In the form which shows a list of participants I show only the primary disability for each participant (using child relationships)
I'd like to be able to filter participants by disability, any disabilty they have, not just primary, and see the resulting participants in my list....
can i do that

or do i have to build an visualforce page to do it ?
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb

Posted 5 years ago

  • 2
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb
Another way to think about this.
I need to write a controller extension on my participants object that takes a bunch of search parameters and uses dynamic soql to get a list of participants

I can't use filters on a skuid model, because they only filter on values that are in the model... and i can't include all the disabilities because that will return multiple rows per participant

so i need a skuid model i can attach to the output of the customer controller's search method

and the ability to submit the search values from the skuid page and invoke the search method ... which should change the contents of my list
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Is it feasible for you to have a separate table on the participant-disability join object? That way you can include & filter on fields from both objects.
Hello Anna, this is exactly the problem I have. How would you do that?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Start with creating your model on the join object.  This allows you to bring in fields from the lookups that go both ways (in Ken's case fields from both the participant record and the disability record.)  Similarly conditions (and therefore filters) can be built on both parent models. 

This will let you display the correct dataset.   Unfortunately you will not be able to edit the data in those secondary objects.  Using a more standard list page to detail page paradigm is usually what is done here - though you can use the queue component to achieve what you are seeking in a single page. 

We still do not have a mechanism for building conditions on children relationships. 
thanks Rob for pointing this out.

I can circumvent this problem, if there is any JS Event that get's fired when changing a filter -> see http://gsfn.us/t/4a5hf.

Maybe you could shed some light on this.
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb
So if I have a separate table for participant disability, are the filters for disability on that table ?
I need to filter on several detail tables at the same time, both disability and race for example

I think I going to have to do this in visualforce
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
yeah i think you could do the disability filters on that table.

meh. there may be a better way to do it than this, but not one that comes to my mind.
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb
I had a different approach come to mind.
Imagine a tabbed form where each tab allowed you to filter participants in different ways.
There might be 8 tabs, of which you actually set 3 filters

then you have one "cummulative" tab that shows the participants that are in all of the 3 filtered models.

The combination could be done by javascipt on the client.

It might actually be helpful to the user to see which set of filters is bringing in which participants.
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
that sounds like it could be pretty cool :)
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb
Actually, what I need to do it write a chain of filters. I start with a list of participants. Then filter for participants that meet some condition.... then generate a list that is an intersection of those 2 lists.... then filter for participants with another condition...and intersect that list with the list i'm "passing through".... I don't know how many filters there will be (3 to 5), so generating a sequence of results and combining them lets me do it dynamically.

I really suspect that this will need to be done in apex...
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Ken that makes my head hurt.  

But I can't see why a set of 5 filters on a single table couldn't achieve the same result?  Filters get executied together as "and" statements - so you'd use  filter 1 to find contacts in South Carolina,  then filter 2 to get contacts who were Accountants, and finally filter 3 on Soda Preference = Coke to get your specific target set of contacts. 

That sounds too easy though.