![]() |
Page History
Table of Contents | ||
---|---|---|
|
The evaluate data macro allows evaluation of mathematical expressions using data in number data macros.
More information on the evaluate data macro
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Basic Mathematics
The following calculates the value of a fraction, initially 1/2.
Code Block |
---|
Wiki Markup |
{scrollbar:icons=false} h1. Evaluate Mathematical Expressions with the Number-data and Eval-data Macros This page provides the [information on the eval-data macro|http://www.customware.net/repository/display/AtlassianPlugins/eval-data] from the Atlassian site. {toc:minLevel=2} The eval-data macro allows evaluation of mathematical expressions using data in number-data macros. h2. Basic Mathematics The following calculates the value of a fraction, initially 1/2. {code}Numerator: {number-data:Numerator|decimal=true}1{number-data} Denominator: {number-data:Denominator|decimal=true}2{number-data} Result: {eval-data:Result|format=#0.0}${Numerator}/${Denominator}{eval-data} Percentage: {eval-data:Percentage|format=##0\%}round(${Result} * 100, 0){eval-data}{code} * |
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 a slash (\) and percent symbol (%) which is the correct percentage markup and shows the percent sign.
The number data macro establishes the numerator. Enter a new value in the Edit Contents view.
Number Data | ||||
---|---|---|---|---|
| ||||
1 |
The number data macro establishes the denominator. Enter a new value in the Edit Contents view.
Number Data | ||||
---|---|---|---|---|
| ||||
2 |
The evaluate data macro displays the result:
Evaluate Data | ||||
---|---|---|---|---|
| ||||
remove {code}\%{code} which is the correct percentage markup and shows the percent sign. Numerator: {number-data:Numerator|decimal=true}1{number-data} Denominator: {number-data:Denominator|decimal=true}2{number-data} Result: {eval-data:Result|format=#0.0}${Numerator}/${Denominator}{eval-data} Percentage: { |
The evaluate data macro displays the percentage:
Evaluate Data | ||||
---|---|---|---|---|
| ||||
=##0}round(${Result} * 100, 0){eval-data} h2. |
Evaluating Data in Tables
An example follows.
Code Block |
---|
Evaluating Data in Tables In the Editview, the text-data and number-data macros present a plus sign with the table. Clicking the plus sign opens the table to accept names of variables and values for them. The eval-data macros calculate the sum and the average. An example follows. {code}{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} {code} {table-data:Values} || Name || Value || | {text- |
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 | ||||
---|---|---|---|---|
| ||||
|
The evaluate data macro calculates the sum of the values in the table:
Evaluate Data | ||
---|---|---|
| ||
data:Name}{text-data} | {number-data:Value}{number-data} | {table-data} Sum: {eval-data:Sum}sumtable("Values", "Value"){eval-data} Average: { |
The evaluate data macro calculates the average of the values in the table:
Evaluate Data | |||
---|---|---|---|
|
| ||
}avgtable("Values", "Value"){eval-data} {scrollbar:icons=false} |