Hello.
I am using the SQL for Confluence plugin (bob swift). I would like to tint cells in tables by condition.
For example, I use the script:
SELECT MONTH([modify_date]) AS month, CONVERT(decimal(10,2),1.00*((CONVERT(decimal(10,2),1.00*SUM(response_1))/(Count(surv_req_id)/12))/3)) AS average
FROM [surv_req]
where issued_date between '2018-01-01' and '2018-12-31'
GROUP BY MONTH([modify_date])
ORDER BY month
And I get such a table.
How do I change the color of the cells in the average column to red if the value is less than 5
db - MSSQL
Hey Marat,
Looking through the documentation for the Bob Swift SQL and Table macros, I don't see an apparent way to selectively change the background color of individual cells. Or even full rows conditionally for that matter.
What I've done in the past for this kind of need is use the emoticons in Confluence which will render with the SQL plugin and a CASE statement in the SQL. Using CASE, you can output the value normally if the value is above 5, or with (x) in front of the number (the red X emoticon in Confluence) if it is below 5. When Confluence processes the text coming from the plugin - the first row in your screenshot would have "(x) 4.75" for example - it will display the (x) as the red X emoticon.
Hope that helps!
Daniel
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.