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.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
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 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