Conditional Formatting Tables from SQL Query Macro?

I currently use the sql query macro quite a bit. I would like to format the table cells in some way that changes the cell color based on any value. Currently its a txt value i'd like to tackle.

Example: Cell value = C and turn cell grey, Cell value = F and turn that cell red.

Hopefully I'm making sense. I use the Table Plus macro and table filter macro often as well but still cant seem to find any that do exactly what i want that similar to excel. Problem is i rely on sql queries to auto populate the data in the cells to minimize manual work needed to update. 

Thank you in advance!

2 answers

0 votes
Bill Bailey Community Champion Sep 23, 2016

Generally the quick answer to something like this is to use CSS, but you cannot write a rule based on content, you need there to be some specific class or ID on the cell. The next answer might be Javascript, but that would help with keyword highlighting, maybe it could format a parent tag based on content?. Bottom line, my thinking is that without some hook in the cell tag, you won't be able to do what you want to do.

Is there maybe another macro i can use?

Can java do both the query to pull the data and also table formatting? 

Im not too savvy with java but i know some CSS and tried it but didn't work. I am a quick learner and if its possible i just need to be pointed in the right direction. The SQL Query macro does allow for some CSS formatting but only limited to row and column color/mouse over highlighting.

Bill Bailey Community Champion Sep 24, 2016

Well I think you best bet is to see if the macro vendor will expose the java objects so that you can write your own macro using Velocity. If they will do that, then you have a chance as you can check the content to then set a class on a table cell that can then be styled with CSS.

Otherwise, my feeling is that it is not worth the effort (or maybe you will get lucky and someone smarter than me will be able to answer this wink ).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,023 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you