• No results found

Operators

In document Chapter 1: FileMaker Pro basics (Page 51-55)

You combine expressions using operators, symbols that determine which operation to perform on the expressions. You place operators between the expressions you want to perform the operation on, as in:

Subtotal + Tax

For this type of data

Do this when you

type a constant Examples

Text Enclose the text in quotation marks (") "Montréal" "514 555 1212"

Number Don’t include thousand separators or currency symbols

123 1234.56

Date Use the value as a parameter of the Date function or TextToDate function. See appendix C, “Summary of functions.”

Date(2,1,1998)

TextToDate("03/04/1998")

Time Use the value as a parameter of the Time function or TextToTime function. See appendix C, “Summary of functions.”

Time(4,14,32)

TextToTime("02:47:35")

This expression Returns

Invoice Total*0.075 7.5 when the value in the Invoice Total field

is 100

First Name & " " & Last Name "John Jones" when the value in the First Name field is “John” and the value in the Last Name field is “Jones”

Relationship Name::Invoice Total*0.075

7.5 when the value in the Invoice Total field is 100. The Invoice Total field is located in a related database

Each operator has a precedence, which determines the order in which calculations are performed in a formula containing more than one operator. FileMaker Pro evaluates operators from left to right and performs multiplication and division before addition and subtraction. You can change the precedence by enclosing the expression you want calculated first in parentheses.

Mathematical operators

Use the following mathematical operators with numeric expressions.

This expression Returns

2+3*2 8

(2+3)*2 10

Choose FileMaker Help Index from the Help menu, and then type:

E

operators

Symbol Name Definition Examples

+ Addition Adds two values 2+2

Subtotal+Sales Tax

– Subtraction or Negation

Subtracts the second value from the first, or changes the sign to + or –

2–2

InvoiceTotal–Discount –2

* Multiplication Multiplies each value Subtotal*Sales Tax DaysLate*.01*LeasePayment

/ Division Divides the first value by the second

Kilometers Driven/Liters Inches/12

^ Power of, or Exponentiation

Raises the first value to the power of the second value

A^2+B^2 returns (A2 + B2)

Radius^3 returns (Radius3)

Choose FileMaker Help Index from the Help menu, and then type:

E

mathematical operators

?

Comparison operators

Comparison operators compare two expressions and return either true

or false (sometimes called a Boolean expression). Arithmetically, a result of true equals 1 and a result of false equals 0.

Logical operators

When you want FileMaker Pro to perform a calculation based on two or more conditions, use logical operators to describe such conditions.

Symbol Name Definition Examples

= Equal to True when both items are equal

38=39 returns false

38=38 returns true

<> Not equal to True when the items are not equal

38<>39 returns true

38<>38 returns false

> Greater than True when the value on the left exceeds the value on the right

5>6 returns false

19>1 returns true

< Less than True when the value on the left is less than the value on the right

5<6 returns true

19<1 returns false

>= Greater than or equal to

True when the value on the left is greater than or equal to the value on the right

5>=6 returns false

5>=5 returns true

<= Less than or equal to

True when the value on the left is less than or equal to the value on the right

5<=6 returns true

19<=18 returns false

Choose FileMaker Help Index from the Help menu, and then type:

E

comparison operators

Operator Definition Example

AND True only when both of two values are true. The result is:

1 true when true AND true

1 false when false AND true

1 false when false AND false

InvoiceTotal<100 AND SalesTax<6

Use AND, OR, or XOR to combine two expressions; use NOT with only one expression.

Text operators

Use the following text operators with text expressions. (Double quotation marks indicate a text expression.)

OR True when either of two values is true. The result is:

1 true when true OR true

1 true when true OR false

1 false when false OR false

InvoiceTotal<100 OR SalesTax<6

XOR True when either, but not both, of two values is true. The result is:

1 false when true AND true

1 true when false AND true

1 false when false AND false

InvoiceTotal<100 XOR SalesTax<6

NOT Changes a value within parentheses from false to true or from true to false. The result is:

1 false when NOT(true)

1 true when NOT(false)

NOT InvoiceTotal>1000

Choose FileMaker Help Index from the Help menu, and then type:

E

logical operators

Symbol Name Definition Examples

& Concatenation Appends the text string on the right to the end of the text string on the left

"XXX" & "ZZZZZ" returns

"XXXZZZZZ"

" " Text constant Marks the beginning and the end of a text constant. Quotation marks without text between them indicate a blank space. If you enter text into a formula without using quotation marks, FileMaker Pro interprets the text as a field name or function name. To put a quotation mark in a text constant, precede it with another quotation mark.

"Sydney, NSW" returns

Sydney, NSW

"" returns an empty (null) value

"The report said ""Confidential"" on the top" returns The report said "Confidential" on the top

Operator Definition Example

In document Chapter 1: FileMaker Pro basics (Page 51-55)

Related documents