Assigning red Font color in a beastmode - Single Value Card
I have a single value card and I'm using the following code to format the dollar value as I concatenate several values into one text value for the card to display. Do you know if there's a way to have the font color display red if the value is negative? Here's a snippet of the code:
CONCAT(
'$',
CASE
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), '.') = 10 THEN /xxx million/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 3),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 4, 3),'M')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), '.') = 9 THEN /xx million/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 2),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 3, 3),'M')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), '.') = 8 THEN /x million/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 1),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 2, 3),'M')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), '.') = 7 THEN /xxx thousand/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 3),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 4, 2),'K')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), '.') = 6 THEN /xx thousand/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 2),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 3, 2),'K')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), '.') = 5 THEN /x thousand/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 1),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU
AS CHAR), 2, 2),'K')
ELSE CAST(Round(Talacki $ (S) TY - ALL BU
,0) AS CHAR)
END
, ' TY',' | '
I haven't attempted Domo Bricks yet… might be something that I have to learn. Would love any guidance here or direction on how to achieve this. I have a string of 6 values that looks something like this:
Total Seasonal Performance
TY$ | LY$ | VAR $ |VAR %
Plan $ | VAR $ to Plan | % to Plan
Thanks in advance!
Answers
-
I'm not sure if you can do conditional formatting on a value card. I'm not where I can test it.
In a card that allows html like a brick, you could do something likeCONCAT(
CASE
WHEN Talacki $ (S) TY - ALL BU < 0 THEN '<span style="color:red;">$'
ELSE '$'
END,
CASE
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 10 THEN -- xxx million
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 4, 3), 'M')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 9 THEN -- xx million
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3, 3), 'M')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 8 THEN -- x million
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 1), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2, 3), 'M')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 7 THEN -- xxx thousand
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 4, 2), 'K')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 6 THEN -- xx thousand
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3, 2), 'K')
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 5 THEN -- x thousand
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 1), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2, 2), 'K')
ELSE
CAST(Round(Talacki $ (S) TY - ALL BU, 0) AS CHAR)
END,
CASE
WHEN Talacki $ (S) TY - ALL BU < 0 THEN '</span>'
ELSE ''
END,
' TY', ' | '
)** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Grrr…I can't seem to response to this question. My responses aren't showing up. Perhaps a graphic will work. For cards with html capability….
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 294 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 607 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 707 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive