Order of Operations
It is possible to do certain math operations using coding functions in Athennian. There’s no limit to the number of operations specified, but the order of operations must adhere to BEDMAS/PEMDAS structure, and use the appropriate mathematical symbol(s). This may require additional parentheses inserted into the code to capture the correct order of operations. Common uses of math operations include, but are not limited to, share calculations, or residency requirements (percentage of directors).
Brackets / Parentheses |
( ) |
Exponents* |
|
Division |
/ |
Multiplication |
* |
Addition |
+ |
Subtraction |
- |
*This is not used within Athennian, and is only presented for reference to the mathematical order of operations.
Using Math with the Count Function
A count function may be used with math operations to perform the calculation(s) specified. Please see examples in the Count with Math Operations section below.
Addition
{(collectionVariable | count)+(numerical value)}
Subtraction
{(collectionVariable | count)-(numerical value)}
Multiplication
{(collectionVariable | count)*(numerical value)}
Division
{(collectionVariable | count)/(numerical value)}
Example: Director Residency
Sample Dataset |
Directors: George Bluth (United States) - confirmed Lindsay Bluth (France) - incoming |
Complex Count & Math Operations
|
Math Operations |
---|---|
Input |
{((directors | status:'confirmed' | filter:'taxCountry':'Canada' | count)/(directors | status:'confirmed' | count))*100}% |
Order of Operations |
|
Meaning |
Calculate the percentage of Canadian directors by dividing the number of Canadian confirmed directors by the total number of confirmed directors, and multiplying by 100. |
Output |
25% |