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
Best Answers
-
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>')
ENDNote: 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.
1 -
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.
0 -
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>')
0
Answers
-
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>')
ENDNote: 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.
1 -
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.
0 -
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.
0 -
@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!
0 -
Resolved. Thank you.
0 -
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?
0 -
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>')
1 -
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>')
0 -
This solution doesn't work in "Pivot View" table card.
Any idea about implementing conditional formatting in pivot views?
0 -
I am trying to use beast – mode to setup some html formats however it is not working for me, below is my code and output snippet for your reference:
Code line:
<div style="color:green; font-weight:bold; margin:-20px; padding:20px">10.5631</div>
While tested on normal HTML page it worked perfectly.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 618 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 741 Beast Mode
- 58 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive