0

User Input Control - Filter multiple columns

I have a Klip with a table that connects to my SQL database. I've created some User Input Controls to filter the table rows.

I have an issue with one of them because I want to select an Item in the dropdown and if Column 'X' has the value OR Column 'Y' has the value, then filter as so.

This is causing issues as I can only filter by one column it seems.

How can I filter by both columns so that the item I pick in the dropdown will select the value in either column?


 

The above picture filters by name 'specialist' in Player 1 column. I want it so it shows rows if 'specialist' is in Player 1 OR Player 2 column.

 

Hope I've explained this ok.

 

Thanks

 

5 comments

  • 0
    Avatar
    Adam Doogan-Smith

    Hey Jonny!

    If you want to filter the table to return rows where column X equals specialist OR column Y equal specialist you will need to add a hidden data slot to the table. From there you can write a quick formula to account for the multiple conditions like so:

    OR(@X:X=$player,@Y:Y=$player)

    This will return either "true" or "false". Then you can right click on the hidden data and select "Filter..." and only select the tickbox beside "true" and filter. This will return rows where column X or column Y is true.

    Hope this helps!

    Adam

  • 0
    Avatar
    Jonny Langleben

    Ok thanks.

     

    Do I add hidden data slot to the User Input Component or the main table? If the latter, how should I link my User Input Control dropdown to this filter?

     

    Thanks

  • 0
    Avatar
    Jonny Langleben

    OR(@X:X=$player,@Y:Y=$player)

     

    I'm only getting FALSE when I filter my hidden data... Do I need to do something with the Player variable first?

     

     

  • 1
    Avatar
    Jonny Langleben

    Ok so I managed to do this, thanks!

     

    I'm now into another problem whereby if I select 'ALL' for players, where I want all players, it gives me no results. This I assume is because of the OR functionality I included in the hidden data?

    How can I get the ALL to work with this too?

     

    Thank you!

  • 0
    Avatar
    Keely Davison

    Hi Johnny,

    For the all case you can add a bit more logic to get it to work

    Try this: 

    OR(@X:X=$player,@Y:Y=$player,$player="_all_")

    Keely

Please sign in to leave a comment.