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.1K Product Ideas
- 1.1K Ideas Exchange
- 1.2K Connect
- 966 Connectors
- 254 Workbench
- Cloud Amplifier
- 1 Federated
- 2.4K Transform
- 75 SQL DataFlows
- 499 Datasets
- 1.8K Magic ETL
- 2.7K Visualize
- 2.2K Charting
- 360 Beast Mode
- 19 Variables
- 481 Automate
- 101 Apps
- 376 APIs & Domo Developer
- 6 Workflows
- 22 Predict
- 6 Jupyter Workspaces
- 16 R & Python Tiles
- 316 Distribute
- 64 Domo Everywhere
- 252 Scheduled Reports
- 59 Manage
- 59 Governance & Security
- 1 Product Release Questions
- 5K Community Forums
- 37 Getting Started
- 23 Community Member Introductions
- 63 Community Announcements
- 4.8K Archive