NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scrollbar
iconsfalse

...

This page provides the information on the eval-data macro from the Atlassian site.

Table of Contents
minLevel

...

2

The eval-evaluate data macro allows evaluation of mathematical expressions using data in number - data macros.

More information on the evaluate data macro

Multiexcerpt include
MultiExcerptNameExitDisclaimer
nopaneltrue
PageWithExcerptwikicontent:Exit Disclaimer to Include

Basic Mathematics

The following calculates the value of a fraction, initially 1/2.

...

Observation: The Basic Mathematics example, with the formatting by the java.text.DecimalFormat rules shown in the example from Atlassian, yields the result 5000%. To obtain 50 it was necessary to remove

Code Block
\%

which a slash (\) and percent symbol (%) which is the correct percentage markup and shows the percent sign.

Numerator: The number data macro establishes the numerator. Enter a new value in the Edit Contents view.


Number Data

...

nameNumerator
decimaltrue
1


Denominator: The number data macro establishes the denominator. Enter a new value in the Edit Contents view.


Number Data

...

nameDenominator
decimaltrue
2


ResultThe evaluate data macro displays the result:


...

Evaluate Data

...

format#0.0
nameResult
${Numerator}/${Denominator}


PercentageThe evaluate data macro displays the percentage:


Evaluate Data

...

format

...

##0

...

name

...

Percentage
round(${Result} * 100, 0)

Evaluating Data in Tables

...

An example follows.

Code Block
{table-data:Values}
|| Name || Value ||
| {text-data:Name}{text-data} | {number-data:Value}{number-data} |
{table-data}

Sum: {eval-data:Sum}sumtable("Values", "Value"){eval-data}
Average: {eval-data:Average}avgtable("Values", "Value"){eval-data}

The table data macro contains a table with text data for the name and number data for the value. In the Edit Contents view, click the plus sign to add a row and enter values for each row.

Table Data
nameValues

...

orderasc

Name

Value

NamewikiINLINE
ValueINLINE

The evaluate data macro calculates the sum of the values in the tableSum:

Evaluate Data

...

nameSum
sumtable("Values", "Value")


AverageThe evaluate data macro calculates the average of the values in the table:

Evaluate Data

...

nameAverage
avgtable("Values", "Value")

...