Any way to color rows based on values in a column?
Best Answer
-
Sure thing. The basic idea is to wrap your cell content in a 100% heigh/100% width div to take care of the background color. The following shows an example of doing a red background:
CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Red Conditional Format', '</a></div>')
Plus another example where we're actually choosing between green, yellow, red:
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>')
ENDYou can obviously tweak the colors as needed.
2
Answers
-
The easiest way to do this is to use a Sumo Card. It allows you to set conditional formatting on cell values. See the help center article for reference: http://wiki.domo.com/confluence/pages/viewpage.action?pageId=44827302
A more involved alternative solution would utilize custom Beast Mode calculcations where we could generate valid HTML to display the formatting you're after. This solution is based on the fact that Domo table cards will *render* valid HTML instead of displaying the text value of the HTML.
0 -
Thanks, I was able to use HTML to change font color, size and background color with conditional formatting I entered.
However, I am wondering if there is a way to actually color the entire cell in the table using HTML? Right now using the font background color only fills in the area around the actual value, not the entire cell. Does anyone know a way to color the entire cell without making a Sumo card?
0 -
Sure thing. The basic idea is to wrap your cell content in a 100% heigh/100% width div to take care of the background color. The following shows an example of doing a red background:
CONCAT('<div style="background-color:#fcbcb7; width: 100%; height:100%; margin:-20px; padding:20px"><a href="#">', 'Red Conditional Format', '</a></div>')
Plus another example where we're actually choosing between green, yellow, red:
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>')
ENDYou can obviously tweak the colors as needed.
2 -
That worked perfectly, thanks so much!
0 -
Incredible!! Nice tip!
Thanks!
0 -
Hello.....I love this idea! Will this work on a case where i'm looking for an is null value to be "highlighted"?
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive