VA FileMan V. 22.0 Getting Started HTML Manual Banner


Main Chapter Getting Started Manual Programmer Manual

Computed Expressions

Operators in Computed Expressions

Computed expressions can consist of a single element. However, often several elements are joined together using operators. Operators are characters that perform some action on elements.

Unary Operators

The simplest operators are the unary operators. They force a numeric interpretation of the element that follows. They can also affect the sign of the resulting number. The unary operators are:

Unary Operator Description
+ Positive numeric interpretation (sign unchanged)
- Negative numeric interpretation (sign changed)

Binary Operators

Another set of operators takes two elements, manipulates them, and returns a result. These are called binary operators. You can use the following binary operators in computed expressions:

Binary Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
\ Integer (truncated) division (e.g., 13\2 = 6)
_ Concatenation (e.g., "AB"_"CDE" = ABCDE)

Boolean Operators

A third set of operators makes a comparison between two elements and returns a true or false value. These are known as Boolean operators. If the outcome of a Boolean operation is true, the value one (1) is returned; if false, zero (0) is returned. You can use these Boolean operators in computed expressions:

Boolean Operator Description
> Greater than
< Less than
= Equal to
] Follows (in alphabetical order)
[ Contains (e.g., "AB"["A" is true; "A"["AB" is false)
! Or, either element is true [e.g., (2=3)!(5<10) is true]
& And, both elements are true [e.g., (2=3)&(5<10) is false]

An apostrophe (') means negation or NOT. It can precede any of the Boolean operators. Thus, 6'>8 is read six is not greater than eight, which is true (a one is returned).

Parentheses in Expressions

In the absence of parentheses, the expression is evaluated strictly left to right. One operator is not given precedence over another. Use parentheses to control the order in which the operations of a computed expression are performed. Expressions within parentheses are evaluated first. Thus 3+4/2 is 3.5, whereas 3+(4/2) is 5.

You can also use parentheses to ensure that the enclosed material is treated as an expression when there might be some ambiguity. For example, suppose you want to force a numeric interpretation of the SSN field. You need to use the + unary operator. However, the following will not yield the desired result:


Is the + the unary operator or the sort specifier (meaning that you want to subtotal results by SSN)? In this case, it will be interpreted as the sort specifier. However, if you put the expression in parentheses, the + will definitely be interpreted as an operator:

    SORT BY: (+SSN)

Example of Compound Expression

An example of a computed expression containing several elements and operators is:


First, the part within the parentheses is evaluated. NUMBER OF BEDS and OCCUPANCY PERCENTAGE are field names. Their contents are multiplied and the result is divided by 100. That result is concatenated with the literal string "Beds occupied: " giving a result like:

    Beds occupied: 484


Reviewed/Updated: March 4, 2007