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.5K Connect
- 1.2K Connectors
- 296 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 614 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 53 App Studio
- 40 Variables
- 677 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 45 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 32 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive