All information in this article is in reference to the Assette Data Object Editor. For information on Data Block Editor Definition (i.e., Python) Calculation Operators and Precedence, see Python Documentation.
With the Assette Data Object Editor, operators specify the type of calculation that you want to perform on elements in a formula—such as addition, subtraction, multiplication, or division. In this article, you’ll learn the default order in which operators act upon the elements in a calculation. You’ll also learn that how to change this order by using parentheses.
Types of operators #
There are five different types of calculation operators: arithmetic, grouping, comparison, text, and reference.
Arithmetic operators #
To perform basic mathematical operations such as addition, subtraction, or multiplication—or to combine numbers—and produce numeric results, use the arithmetic operators in this table.
Arithmetic operator | Meaning | Example |
---|---|---|
+ (plus sign) | Addition | 3+3 |
– (minus sign) | Subtraction Negation | 3–1 |
* (asterisk) | Multiplication | 3*3 |
/ (forward slash) | Division | 3/3 |
Grouping Operators #
To perform groupings within the Assette Data Object Editor, use a set of parentheses “( )” to enclose the items to be grouped together. This is most commonly done in order to change the order of evaluation, enclose in parentheses the part of the formula to be calculated first.
Grouping Operator | Example |
---|---|
( ) set of open and close parentheses | (5+2)*3 |
For example, the following formula results in the value of 11, because Assette calculates multiplication before addition. The formula first multiplies 2 by 3, and then adds 5 to the result.
5+2*3
By contrast, if you use parentheses to change the syntax, adds 5 and 2 together and then multiplies the result by 3 to produce 21.
(5+2)*3
Comparison operators #
With the operators in the table below, you can compare two values. When two values are compared by using these operators, the result is a logical value either TRUE or FALSE.
Comparison operator | Meaning | Example |
---|---|---|
= (equal sign) | Equal to | 3=3 |
> (greater than sign) | Greater than | 4>3 |
< (less than sign) | Less than | 3<4 |
>= (greater than or equal to sign) | Greater than or equal to | 4>=3 |
<= (less than or equal to sign) | Less than or equal to | 3<=4 |
<> (not equal to sign) | Not equal to | 4<>3 |
#
Order of Operations & Precedence #
In some cases, the order in which calculation is performed can affect the return value of the formula, so it’s important to understand the order— and how you can change the order to obtain the results you expect to see.
The Assette Data Object Editor calculates the formula from left to right, according to a specific order for each operator in the formula. If you combine several operators in a single formula, the Assette Data Object Editor performs the operations in the order shown in the following table. If a formula contains operators with the same precedence — for example, if a formula contains both a multiplication and division operator — the Assette Data Object Editor evaluates the operators from left to right.
Operator | Description |
---|---|
( ) | Parenthesis or grouping |
^ | Exponentiation |
* and / | Multiplication and division |
+ and – | Addition and subtraction |
= < > <= >= <> | Comparison |
#
How Assette Converts Values in Formulas #
When you enter a formula, Assette expects specific types of values for each operator. If you enter a different kind of value than is expected, Assette may convert the value.
The formula | Produces | Explanation |
“1”+”2″ | 3 | When you use a plus sign (+), Assette expects numbers in the formula. Even though the quotation marks mean that “1” and “2” are text values, Assette automatically converts the text values to numbers. |
1+”$4.00″ | 5 | When a formula expects a number, Assette converts text if it is in a format that would usually be accepted for a number. |
“6/1/2001”-“5/1/2001” | 31 | Assette interprets the text as a date in the mm/dd/yyyy format, converts the dates to serial numbers, and then calculates the difference between them. |
SQRT (“8+1”) | ERROR! | Assette cannot convert the text to a number because the text “8+1” cannot be converted to a number. You can use “9” or “8”+”1″ instead of “8+1” to convert the text to a number and return the result of 3. |
“A”&TRUE | ATRUE | When text is expected, Assette converts numbers and logical values such as TRUE and FALSE to text. |