Conditional formatting of Columns in a table view card

Reply
Highlighted
White Belt

Conditional formatting of Columns in a table view card

We need more options to format columns in a card table view.  In particular the ability to colorize a group of columns that are in the same category, ex. Admitted 2016, Admitted 2015 Admitted 2014, Inquiry 2016 Inquiry 2015 Inquiry 2014


Accepted Solutions
Highlighted
Orange Belt GTA Orange Belt
Orange Belt

Re: Conditional formatting of Columns in a table view card

This is a current workaround to get this to work. I wanted to make sure that you note that because this is HTML, you won't be able to export to a Powerpoint and still see the colors.

 

The following Beast Mode examples will help you create conditional formatting on a standard (non-Sumo) table which I've used in the instances that a client needs a modified drill path table view. At present, these options are not available w/in Sumo tables but may be as development continues.

 

The formatting is accomplished by creating an HTML string which contains a DIV element where the background color changes based on user defined conditions. The three colors are "Domo" colors as well so it wil keep a consistent user experience.

 

Green Background (#bbe491):

 

CONCAT('<div style="background-color:#bbe491; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Green Conditional Format', '</a></div>')

 

Yellow Background (#fccf84):

 

CONCAT('<div style="background-color:#fccf84; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Yellow Conditional Format', '</a></div>')

 

Red Background (#fcbcb7):

 

CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Red Conditional Format', '</a></div>')

 

Note: The <a> element with a reference to # prevents the user from drilling on that column as it would create a filter for the full HTML string.

 

Working Example:

 

CASE

WHEN `CHANGE` > 0 THEN CONCAT('<div style="background-color:#bbe491; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', `CHANGE`, '</a></div>')

WHEN IFNULL(`CHANGE`, 0) = 0 THEN CONCAT('<div style="background-color:#fccf84; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', `CHANGE`, '</a></div>')

WHEN `CHANGE` < 0 THEN CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', `CHANGE`, '</a></div>')

END

 Screen Shot 2015-01-23 at 1.35.33 PM.png

 

Note: Keep in mind that the value this Beast Mode returns is a STRING, any aggregations must be done w/in Beast Mode as aggregations will be disabled when building cards.

View solution in original post

Highlighted
Orange Belt GTA Orange Belt
Orange Belt

Re: Conditional formatting of Columns in a table view card

If you just remove out the case statement and just leave the CONCAT, that should give you what you want. You would just create a different Beastmode for each column that applies to the category. 

Screen Shot

View solution in original post

Highlighted
Blue Belt

Re: Conditional formatting of Columns in a table view card

thanks I actually did exactly that :

 

WHEN Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`) < 0 THEN CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', Round(Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`)), '</a></div>')

View solution in original post


All Replies
Highlighted
Orange Belt GTA Orange Belt
Orange Belt

Re: Conditional formatting of Columns in a table view card

This is a current workaround to get this to work. I wanted to make sure that you note that because this is HTML, you won't be able to export to a Powerpoint and still see the colors.

 

The following Beast Mode examples will help you create conditional formatting on a standard (non-Sumo) table which I've used in the instances that a client needs a modified drill path table view. At present, these options are not available w/in Sumo tables but may be as development continues.

 

The formatting is accomplished by creating an HTML string which contains a DIV element where the background color changes based on user defined conditions. The three colors are "Domo" colors as well so it wil keep a consistent user experience.

 

Green Background (#bbe491):

 

CONCAT('<div style="background-color:#bbe491; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Green Conditional Format', '</a></div>')

 

Yellow Background (#fccf84):

 

CONCAT('<div style="background-color:#fccf84; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Yellow Conditional Format', '</a></div>')

 

Red Background (#fcbcb7):

 

CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Red Conditional Format', '</a></div>')

 

Note: The <a> element with a reference to # prevents the user from drilling on that column as it would create a filter for the full HTML string.

 

Working Example:

 

CASE

WHEN `CHANGE` > 0 THEN CONCAT('<div style="background-color:#bbe491; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', `CHANGE`, '</a></div>')

WHEN IFNULL(`CHANGE`, 0) = 0 THEN CONCAT('<div style="background-color:#fccf84; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', `CHANGE`, '</a></div>')

WHEN `CHANGE` < 0 THEN CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', `CHANGE`, '</a></div>')

END

 Screen Shot 2015-01-23 at 1.35.33 PM.png

 

Note: Keep in mind that the value this Beast Mode returns is a STRING, any aggregations must be done w/in Beast Mode as aggregations will be disabled when building cards.

View solution in original post

Highlighted
White Belt

Re: Conditional formatting of Columns in a table view card

Close enough though this will make my pure-play user squirm since it's not really configurable.  We just need the full column a single color so all the columns with the title "Admitted" will be the same column.

Highlighted
Orange Belt GTA Orange Belt
Orange Belt

Re: Conditional formatting of Columns in a table view card

If you just remove out the case statement and just leave the CONCAT, that should give you what you want. You would just create a different Beastmode for each column that applies to the category. 

Screen Shot

View solution in original post

Highlighted
Moderator

Re: Conditional formatting of Columns in a table view card

@jbanez-westmont, tagging you in case you haven't seen GTA's last response.

 

If GTA's post answered your question, please mark it as the solution!

Highlighted
White Belt

Re: Conditional formatting of Columns in a table view card

Resolved.  Thank you.

Highlighted
Blue Belt

Re: Conditional formatting of Columns in a table view card

This is great!  I just used it and added a Sum statement to it

 

CASE

WHEN Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`) > 0 THEN CONCAT('<div style="background-color:#bbe491; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`), '</a></div>')

WHEN IFNULL(Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`), 0) = 0 THEN CONCAT('<div style="background-color:#fccf84; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`), '</a></div>')

WHEN Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`) < 0 THEN CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`), '</a></div>')

END

 

Only problem is I'm getting a decimal place in my answer.  Any clue on how to use a Round in here to just give me a whole number?

Highlighted
Yellow Belt

Re: Conditional formatting of Columns in a table view card

In your CONCAT, throw a ROUND function around the resulting formula, and round to 0 places. For example: 

 

CASE

WHEN Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`) > 0 THEN CONCAT('<div style="background-color:#bbe491; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', ROUND(Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`), 0) '</a></div>')

 

 

Highlighted
Blue Belt

Re: Conditional formatting of Columns in a table view card

thanks I actually did exactly that :

 

WHEN Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`) < 0 THEN CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', Round(Sum(`Returns`+ `In Yard` ) - Sum(`Committed` + `Unuseable`)), '</a></div>')

View solution in original post

Highlighted
White Belt

Re: Conditional formatting of Columns in a table view card

This solution doesn't work in "Pivot View" table card.

Any idea about implementing conditional formatting in pivot views?



 

Announcements
Win free lodging at Domoapalooza! We want you to share you favorite Domo tips and tricks. Click here for more details!