![]() |
Page History
Wiki Markup |
---|
{scrollbar:icons=false} |
Evaluate Mathematical Expressions with the Number-data and Eval-data Macros
...
Page info | ||||
---|---|---|---|---|
|
Table of Contents | ||
---|---|---|
|
The eval-evaluate data macro allows evaluation of mathematical expressions using data in number - data macros.
More information on the evaluate data macro
Basic Mathematics
The following calculates the value of a fraction, initially 1/2.
...
which is the correct percentage markup and shows the percent sign.
NumeratorThe number data macro establishes the numerator:
Number Data | ||||
---|---|---|---|---|
| ||||
1 |
Denominator The number data macro establishes the denominator:
Number Data | ||||
---|---|---|---|---|
| ||||
2 |
ResultThe evaluate data macro displays the result:
Evaluate Data | ||||
---|---|---|---|---|
| ||||
${Numerator}/${Denominator} |
Percentage The evaluate data macro displays the percentage:
Evaluate Data | ||||
---|---|---|---|---|
| ||||
round(${Result} * 100, 0) |
Evaluating Data in Tables
In the Editview, Edit Contents view the text - data and number - data macros present display a plus sign with the table. Clicking Selecting the plus sign opens the table to accept names of variables and values for them. The eval-evaluate data macros calculate the sum and the average.
...
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.
Table Data | ||||
---|---|---|---|---|
| ||||
|
SumThe evaluate data macro calculates the sum of the values in the table:
Evaluate Data | ||
---|---|---|
| ||
sumtable("Values", "Value") |
Average The evaluate data macro calculates the average of the values in the table:
Evaluate Data | ||
---|---|---|
| ||
avgtable("Values", "Value") |
Wiki Markup |
---|
{scrollbar:icons=false} |