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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 297 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