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.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