Conditional formatting in confluence

Hi Guys,

I have a table which produces a scores based on information entered into a scaffold form. Is it possible to change the cell or text colour based on the score value? For example is the score is below 40% this would turn red, 41%-60% this would turn orange and 61%+ would turn green. Ive started messing with Jquery which i know nothing about and probably heading in the wrong direction. I know the option is available in Excel (conditional formating) and was hoping someone would know how to do this with Confluence

Cheers

jason

3 answers

1 accepted

Well, here a beginning of something you might try: put your scores on other pages, and make the text on each page be set to a color based on a label. The {include} all those pages into one master table.

other pages, for example Page a, Page b and Page c contain:

My number is {show-if:label=small}{color:blue}24{color}{show-if}{show-if:label=medium}{color:green}24{color}{show-if}{show-if:label=large}{color:red}24{color}{show-if}

Where the number of interest is 24 or others. Change the colors to match your requirements. Then label each page with one of "small", "medium", "large". The roll-up page can look like this:

|| Values ||
| {include:Page a} |
| {include:Page b} |
| {include:Page c} |

This will render a table with three colored numbers in it.

I tried to think of how I could combine this with the reporting plug in, but it spits out all the {show-if} macros.

based on this link http://community.customware.net/customware/topics/using_the_show_if_macro_with_scaffolding_data, ive created a text box where you can enter 1,2, or 3. The the report block produces text and a background colour based on the content. I just need to get this to work with the eval-data macro

|{text-data:test}{text-data}|

|{report-block}

{local-reporter:data:test}

{text-filter:@self|include=1}

{report-body}{bgcolor:yellow}test1{bgcolor}{report-body}

{text-filter:@self|include=2}

{report-body}{bgcolor:green}test1{bgcolor}{report-body}

{text-filter:@self|include=3}

{report-body}{bgcolor:blue}test1{bgcolor}{report-body}

{report-empty}Nothing is selected.{report-empty}

{report-block}|

Hello!

For conditional formatting in Confluence you may use CelesteCS Conditions for Confluence.

Assume you need to set a specific background color for some values on your table, for example, for 'Yes' make it light-green and for 'No' make it light-red. You just put your table into Conditional Rules Manager macro and add two Conditional Rule macros to specify rules of type 'Element Value Is Equal To', which is by default. In one of the rules you specify 'Value 1' = 'Yes' and 'Background color' = 'highlight-green' and in another one 'Value 1' = 'No' and 'Background color' = 'highlight-red'. That's it! The cells will be formatted appropriately.

As you see, it's very simple - just add a couple of macros and configure it properly. No need for doing it manually, writing user macros or use source code editors.

There are more than a dozen of conditional rule types supported. Plus, you may replace the text, not just to format it.

We are the CelesteCS Conditions for Confluence plugin vendor, so you may contact us directly if you have any additional questions or suggestions.

Thanks!

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,890 views 25 10
Join discussion

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