LINKTOFILTEREDVIEW Help

Hello all,

I’m having some trouble writing this expression. Here’s what I need:

I have an action button inside the view ANIMAL_DETAIL.
Lets suppose I’m seeing the details of a female dog named “Annie”

Every animal has its father and mother (references to the same table - to another animals). So, in this view, Im gonna show all animal’s “kids”. (in the example, all annie’s kids)

So, I want the linktofilteredview to go to the “Kids” view (that’s working), and to compare the Animal’s name from previous view (ANIMAL_DETAIL) to all data in the google sheets.
If the animal in the previous view (animal_detail) is a female animal, to find all animals that have their mother named the name in the previous view (annie).
If it’s a male, all the animals whose fathers have its name.

I’m having trouble because I don’t know how to get the info (annie’s name) from the previous view I was on.

I’m not sure if it’s too confusing, english is not my first language hehe… Anyway, if it’s needed, I can explain it again

Thank you all :slight_smile:

2 Likes

Try using this Function in LINKTOFILTEREDVIEW()

1 Like

A combination of IN() and SELECT() Could solve your problem. If you can show me your table structure I can help you with that.

You can use below expression for your reference.

LINKTOFILTEREDVIEW("ViewNameOfLookuptable",
in([Lookuptable ID],
         select(Lookuptable Name[Lookuptable ID],
                      [Column to check]="Kids"
              )
       )
 )
2 Likes

Sure, here it goes (Its in portuguese, so I translated in the post)

image
Pai = father
Mãe = mother
Nome completo = complete name (its a concatenation between some names + indentifying codes)

image

Ver Filhos = see kids
In the fields Pai and Mãe, its shown the complete name of both

Whenever clicking in the action “Ver filhos” It should open a new view with all kids from the animal shown in this view

Is it enough to you understand ? or its missing something ? in the table structure

Thank you again

2 Likes

Can you show me your kids table ?

1 Like

Blockquote
Column to check]=“Kids”

The problem with this, I dont have a column named Kids, because one animal can have a lot of kids. The connection I have is: all animals refers to a father and a mother, but the mother and father have no connection to their kids. So I have to find their kids finding where they are put as father/mother in the sheets.

image

something like that

edit : for example:

I have to find “Annie’s kids”, so I have to search in the sheets any other animals who have Annie’s ID as their mother.

I dont have a column or a table that I could pull annie’s kids from there, I have to do a search in all mothers and find annie’s ID on it, and select those rows to show in the view

This can be tricky but we can use 2 Actions to solve this.

This will work according to Sex of Parent animal.
You have a child table with kids Father and Mother

Action 1:
We would use sex of parent animal as MALE.
That means this animal is always FATHER.

Here we use an action to go another table view.

LINKTOFILTEREDVIEW(“ViewNameOfLookuptable”,
in([Lookuptable ID],
  select(Lookuptable Name[Lookuptable ID],
  [PAI]=[_THISROW].[YOUR ROW ID]
        )
   )
)

Condition for this action would be [sex]="Male"

Same applies for Action 2 also but with a bit changes.

Action 2:
We would use sex of parent animal as FEMALE.
That means this animal is always MOTHER.

Here we use an action to go another table view.

LINKTOFILTEREDVIEW(“ViewNameOfLookuptable”,
in([Lookuptable ID],
        select(Lookuptable Name[Lookuptable ID],
        [Mãe]=[_THISROW].[YOUR ROW ID]
          )
    )
)

Condition for this action would be [sex]="Female"

This will switch the action according to the parent sex and lookup tables according to father and mother ID and show kids related to this Animal.

Hope this Helps.

3 Likes

Thank you ! <3

Worked perfectly

2 Likes