Operator Precedence in Quick Base Formulas

Operators play an important role in the Quick Base formula language. Operators are special symbols like + and * that act upon one or two values to return a new value. They tell Quick Base what you want to do with the values in your formula. There are two types of operators:

Rules of Operator Precedence

Quick Base doesn't evaluate a formula in a random order. It doesn't even evaluate a formula from left to right, as many people imagine. Instead, operators have a predefined order of precedence. In other words, Quick Base acts on certain operators before it acts upon others. For example, * has higher precedence than +. This means that the expression 3+4*2 evaluates to 11, not 14.

Tip: To manually control operator precedence, enclose portions of your formula in parentheses. Quick Base always evaluates operators within parentheses first and treats the result as a single value before moving on to the rest of the formula. (Read more in Writing a formula section of the Using Formulas topic.)

In the following table, operators are listed from highest precedence to lowest precedence.

Precedence Level Operator Evaluation Order in Expressions
1 (highest) unary +, unary -, not Right to left
2 ^ Left to right
3 *, / Left to right
4 binary +, binary -, & Left to right
5 <, >, <=, >= Left to right
6 =, <> Left to right
7 and Left to right
8 (lowest) or Left to right

When binary operators of the same precedence appear next to each other, they are evaluated left to right. When unary operators appear next to each other they are evaluated right to left.

For example, the following expressions are equivalent, and they return the Boolean value true.

3 < 2 + 1 / 5 + --3 and 8 > 3

(3 < ((2 + (1 / 5)) + (-(-3)))) and (8 > 3)

Related Topics:

 

Go back      |       |   

© 1999-2018  QuickBase, Inc.  All rights reserved.  Legal Notices.