Writing a Beast mode for a table card that selects a column and only displays rows with values

Hello, I am trying to write a beastmode for a table card where it picks a specific column based on a variable then only displays the rows in which that column has values. I know how to make a variable to select columns, but I can not get it to leave out the rows in which that column is blank. The first three images are what I have so far, how the data is structured and the output. Ideally I would like every row after 10 to not show up when testing=1 only rows 11-20 to show when testing is 2 and only rows 21-29 to show when testing=3

The other method Im thinking could work but I honestly dont even know how to approach or if it is even possible would be to put them all in the same column and some how filter for specific values in the column.

I do not however want a traditional filter because if they are all visible at the same time it will overwhelm the user think 10,000+ rows. I want to use a variable for this so that they can only view one unit type at a time to keep the table digestible which is very important to my bosses.

So with the data formatted as it is in the fourth image a beast mode that Only show rows with A in the Unit type column when a variable is set to A. Only show rows with B in the unit type column when a variable is set to B. Only show rows with C in the unit type column when a variable is set to C. Specifically without being able to view any other data besides the one that is specifically selected.

Best Answer

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    COSLESCE is a function that can work in a beast mode but may not be listed in the function list


    using your original beast mode it’s look something like this

    COALESCE((CASE
    When 'testing'= '1' then 'Climate Controlled'
    When 'testing'= '2' then 'Refrigirated Wine Locker'
    When 'testing'= '3' then 'Drive Up'
    END), 'IS NULL')
    

    When the selected column is null it will a value of IS NULL you can put the beast mode into the filter and then exclude the IS NULL values


    an alternative is to use IFNULL instead of COALESCE

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**

Answers

  • create a beast mode to do a case statement to return a value if it’s not null and then add that as a filter to your card

     COALESCE(your beast mode to select the column value, 'IS NULL')
    

    then just filter where the beast mode doesn’t return IS NULL

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • @GrantSmith How would I do that? What does that even mean? Coalesce is not a function in beastmodes. Assume Im very new to beastmodes cause your answer feels like you just restated my question as a statement hahaha. Thats what im trying to do, if I knew how to do it I wouldnt have posted this lol.

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    COSLESCE is a function that can work in a beast mode but may not be listed in the function list


    using your original beast mode it’s look something like this

    COALESCE((CASE
    When 'testing'= '1' then 'Climate Controlled'
    When 'testing'= '2' then 'Refrigirated Wine Locker'
    When 'testing'= '3' then 'Drive Up'
    END), 'IS NULL')
    

    When the selected column is null it will a value of IS NULL you can put the beast mode into the filter and then exclude the IS NULL values


    an alternative is to use IFNULL instead of COALESCE

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • thank you, sorry im so inexperienced hahaha