table-data use column max value in a text-data field

  • 1
  • Question
  • Updated 2 years ago
  • (Edited)
Hi
I am trying to use within an eval-data filed in a table-data macro the maximum value from a 'column' of data.

The eval-data is adding 3 values, the first 2 are simple as they grab the relvant column from that particular row. However, the third value needs to do a loookup on the table and return the maximum value for a particular column. 

I can get the value outside of the table within a grouping-reporter and  grouping stats. The problem I have is when trying to grab the maximum value and read it into the table-data macro as another column

I hope this makes sense.

Column1      Column2       Max of column2                Calculation Column1 + Column2 + Column3
5                       4                    10                                                                     19
4                       4                   10                                                                      18
1                      10                 10                                                                        21
2                      6                   10                                                                         18

thx Steve


UPDATE

This also applies to the summaryvalue. I need to be able to pull this and use it in a another table
Photo of Steve Boydon

Steve Boydon

  • 30 Posts
  • 3 Reply Likes
  • useless

Posted 2 years ago

  • 1
Photo of Nurhana Ziana Bt. Hanafi

Nurhana Ziana Bt. Hanafi, Employee

  • 3500 Posts
  • 269 Reply Likes
Hello Steve,

This is possible with {report-eval} macro from Reporting plugin e.g.

{table-data:name=myTable}
||c1||c2||
|{number-data:name=num1}{number-data}|{number-data:name=num2}{number-data}|
{table-data}

Report-Eval: {report-eval:evalNum}%data:myTable>stats-on:"data:num1">stats:max value%{report-eval}
----------------------------------
{report-table}
{local-reporter:data:myTable}{local-reporter}
{report-column:title=c1}
{report-info:data:num1}
{report-column}
{report-column:title=c2}
{report-info:data:num2}
{report-column}
{report-column:title=c3}
{report-info:variable:evalNum}
{report-column}
{report-column:title=Total}
{report-eval:totalNum}%data:num1%+%data:num2%+%variable:evalNum%{report-eval}
{report-column}
{report-table}
Hope this helps.

Thanks&Regards,
Ziana
Photo of Steve Boydon

Steve Boydon

  • 30 Posts
  • 3 Reply Likes
Ziana

Thanks for the response.

I'm getting there.  I was hoping to do it all in within the table-data macro using the evaluate data macro from scaffolding.  I have managed to nest the report-eval in a text-data and it shows me the full value. Howevewr, when trying to use it in the table data it does not add the data column. As below.

My alternative is to have table-data hidden when page saved to just show the report. as per this reponse

https://community.servicerocket.com/servicerocket/topics/report_eval_table_data_and_calculations_wit...

However the show-if does not give me the edit contents button when set to edit.

<ac:structured-macro ac:name="table-data">  <ac:parameter ac:name="name">myTable</ac:parameter>
  <ac:rich-text-body>
    <table>
      <tbody>
        <tr>
          <th>
            <p>c1</p>
          </th>
          <th>
            <p>c2</p>
          </th>
          <th colspan="1">c3</th>
          <th colspan="1">Calc</th>
          <th colspan="1">Calc</th>
        </tr>
        <tr>
          <td>
            <ac:structured-macro ac:name="number-data">
              <ac:parameter ac:name="name">num1</ac:parameter>
              <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
              <ac:plain-text-body><![CDATA[ ]]></ac:plain-text-body>
            </ac:structured-macro>
          </td>
          <td>
            <ac:structured-macro ac:name="text-data">
              <ac:parameter ac:name="content">text</ac:parameter>
              <ac:parameter ac:name="name">num4</ac:parameter>
              <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
              <ac:parameter ac:name="type">line</ac:parameter>
              <ac:rich-text-body>
                <p> </p>
              </ac:rich-text-body>
            </ac:structured-macro>
          </td>
          <td colspan="1"> </td>
          <td colspan="1">
            <ac:structured-macro ac:name="text-data">
              <ac:parameter ac:name="name">maxvalue</ac:parameter>
              <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
              <ac:parameter ac:name="type">line</ac:parameter>
              <ac:rich-text-body>
                <ac:structured-macro ac:name="report-eval">
                  <ac:parameter ac:name="format">##</ac:parameter>
                  <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
                  <ac:parameter ac:name="">evalNum</ac:parameter>
                  <ac:plain-text-body><![CDATA[%data:myTable>stats-on:"data:num1">stats:max value%]]></ac:plain-text-body>
                </ac:structured-macro>
              </ac:rich-text-body>
            </ac:structured-macro>
            <p> </p>
            <p> </p>
          </td>
          <td colspan="1">
            <ac:structured-macro ac:name="eval-data">
              <ac:parameter ac:name="name">calcineed</ac:parameter>
              <ac:parameter ac:name="format">##</ac:parameter>
              <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
              <ac:plain-text-body><![CDATA[${num1} + ${num4} + ${maxvalue}]]></ac:plain-text-body>
            </ac:structured-macro>
          </td>
        </tr>
      </tbody>
    </table>
  </ac:rich-text-body>
</ac:structured-macro>
(Edited)