grouping-stats and eval-data - do they mix well?

I'm having a problem with getting eval-data to work in my report, the report-table shown below shows the component and outage sum correctly but not the percentage. Seems there is an issue with getting a value back for %Site-AvailabilityOutageTotal% but I can't figure out what.

||Component||Outage Summary||Linked ID||Linked OID||Outage||
| {list-data:Site-Component}
{list-option}Admin Console{list-option}
{list-data} | {text-data:Site-AvailabilitySummary} | {text-data:Site-AvailabilityID} | {text-data:Site-AvailabilityOID} | {number-data:Site-AvailabilityOutage|decimal=true} minutes|


{report-column:title=Outage}{report-info:grouped:Count > stats:sum} minutes{report-column}
{replace-and-render}{replace-item:%NumberOfDays%}{get-data:name=reporting-days}{replace-item}{replace-item:%Site-AvailabilityOutageTotal%}{report-info:grouped:Count > stats:sum}{replace-item}{replace-body}{report-column:title=Percentage}{eval-data:Percentage|format=#0.00}round((((60*24*%NumberOfDays%)-%Site-AvailabilityOutageTotal%)/(60*24*%NumberOfDays%))*100, 2){eval-data}%{report-column}{replace-body}{replace-and-render}

{report-empty}Nothing to see.{report-empty}


1 answer

1 accepted

0 votes
Accepted answer

Hi Charlie,

They can work together, but you can't put {eval-data} macros into a report. Reports can pull values from {eval-data} that is in a Scaffolding {table-data} or {repeating-data} however.

If you want to do maths inside a report, use the {report-eval} macro instead. It works quite similarly to the {eval-data} macro, but has a slightly different syntax. Also, values are only stored for the life of that specific page view, whereas for {eval-data} they are stored more permanently with other Scaffolding data.

In any case, to get your report working there are two options:

1. Move the {eval-data} into the {table-data} instead, then refer to it as you would any other Scaffolding data field (ie. '{report-info:data:Percentage}').

2. Use {report-eval} instead, like so:

  {report-eval:Percentage|format=#0.00}round((((60*24*%report:content root > data:reporting-days%-%grouped:Count > stats:sum%/(60*24*%report:content root > data:reporting-days%))*100, 2){report-eval}

Note that you can completely remove the {replace-and-render} from this report. Also, I'm assuming that 'reporting-days' is a {number-data} field on the page somewhere that you haven't listed.

In general, it's best not to mix Scaffolding macros into reports. You can do the reverse quite safely - put Reporting macros into {table-data}/{repeating-data}, but it doesn't work so well in the other direction.

Hope that helps!

Hi David,

Thanks for the detail, I tried that out but I got an error:

report-eval: Missing ")" to match a previous "(".

round((((60*24*%report:content root > data:reporting-days%-%grouped:Count > stats:sum%/(60*24*%report:content root > data:reporting-days%))*100, 2)

Using the information around report-eval I was able to resolve and complete my report.

Many thanks

Great! I was just attempting to copy your example, but I probably missed a closing bracket somewhere...

Glad it's working.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

130 views 3 4
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