Nested Concatenations in Beast Mode

Whenever we use nested Concatenations with Case Statements, every Concatenations gives a break line.
How to avoid that ?
CONCAT(
'Last Week SEO had ',
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END)),
' Visits, which was ',
ABS(ROUND(((ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END))
-
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,-6)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END)))
/
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,-6)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END)))*100)),
'% ',
CASE WHEN
(((ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END))
-
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,-6)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END)))
/
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,-6)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits` END)))*100) > 0
THEN CONCAT('<div style="color:#228B22">',' increase WoW ','</div>') ELSE CONCAT('<div style="color:#ff0000">',' decrease WoW ','</div>') END,
(CASE when
(
(((ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits`END))
)
-
(
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),371)) and YEAR(`Date`) = YEAR(CURDATE())-1 and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits`END))
))
/
(
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),371)) and YEAR(`Date`) = YEAR(CURDATE())-1 and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits`END)))
)*100)>0
then ', Up by ' else ', Down by' end),
'. YoY stands at ',
ROUND((((ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),7)) and YEAR(`Date`) = YEAR(CURDATE()) and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits`END))
)
-
(
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),371)) and YEAR(`Date`) = YEAR(CURDATE())-1 and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits`END))
))
/
(
ROUND(SUM(CASE WHEN WEEK(DATE_SUB(`Date`,1)) = WEEK(DATE_SUB(CURRENT_DATE(),371)) and YEAR(`Date`) = YEAR(CURDATE())-1 and `Tracking Code Program` = 'SEO' and `API Name` = 'Adobe Rev'
THEN `Visits`END)))
)*100),
'%.'
)
Best Answers
-
I believe your issue is the HTML you are injecting. A <div> element will cause a "line break" to occur (not truly a line break but it comes down to the CSS styling that makes it appear as such).
There are many different ways to resolve this. If you are familiar with CSS, you can add some inline styling like "style="display: inline;" into the <div>. So it would look like:
CONCAT('<div style="color:#228B22; display: inline;" >',' increase WoW ','</div>')
If you aren't familiar with CSS though, you can try switching the <div> element to a <span> element.
Both should work, but let me know if not.
2 -
+1 for <span> rather than <div>. I've accomplished the desired result using <span>.
Thank you, @dthierjung
0
Answers
-
I believe your issue is the HTML you are injecting. A <div> element will cause a "line break" to occur (not truly a line break but it comes down to the CSS styling that makes it appear as such).
There are many different ways to resolve this. If you are familiar with CSS, you can add some inline styling like "style="display: inline;" into the <div>. So it would look like:
CONCAT('<div style="color:#228B22; display: inline;" >',' increase WoW ','</div>')
If you aren't familiar with CSS though, you can try switching the <div> element to a <span> element.
Both should work, but let me know if not.
2 -
+1 for <span> rather than <div>. I've accomplished the desired result using <span>.
Thank you, @dthierjung
0 -
@dthierjung @DanB Thankyou for the quick solution. It works exactly the way i needed. <span> is the way out
0
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 310 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 113 SQL DataFlows
- 650 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 791 Beast Mode
- 78 App Studio
- 43 Variables
- 753 Automate
- 187 Apps
- 478 APIs & Domo Developer
- 71 Workflows
- 17 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 407 Distribute
- 118 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 141 Manage
- 137 Governance & Security
- 8 Domo Community Gallery
- 47 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive