Displaying content conditionally

You can use the FMP-If and FMP-Else tags to display HTML in a page conditionally. A useful application of this feature is for displaying messages in reply and error pages.

There are reserved words or codes that can be used to specify a condition. The comparison operators that can be used are indicated in the following table.

This comparison operator

Indicates

.eq.

Equals

.neq.

Not equals

.gt.

Greater than

.gte.

Greater than or equal to

.lt.

Less than

.lte.

Less than or equal to

.cn.

Contains

.ncn.

Does not contain

Using a True/False condition

A true/false or Boolean expression can be used to test a condition. The comparison operators that can be used for a true/false condition are equals (.eq.) and not equals (.neq.). For example, to test if the database is sorted, you can use this syntax in specifying the condition in an FMP-If tag:

IsSorted.eq.False

Using a numeric comparison condition

Use the following codes or reserved words to test numbers or specific error numbers or numeric information or statistics on the current state of the FileMaker Pro database. You can use all comparison operators except for contains (.cn.) and does not contain (.ncn.).

This number

Indicated by this code

Can be used as in this example

Current error number

CurrentError

CurrentError.eq.509

Records in found set

CurrentFoundCount

CurrentFoundCount.gte.100

Current maximum number of records on a page

CurrentMax

CurrentMax.lte.50

Current records in database

CurrentRecordCount

CurrentRecordCount.gt.1000

Current record number

CurrentRecordNumber

CurrentRecordNumber.gt.500

Current number of records skipped at the beginning of a range

CurrentSkip

CurrentSkip.lt.20

Record number of the last record in a range

RangeEnd

RangeEnd.neq.20

Number of records shown in range

RangeSize

RangeSize.eq.40

Record number of first record in range

RangeStart

RangeStart.eq.1

Using a text comparison condition

When using a text comparison condition, all comparison operators are allowed. As a general rule, any CDML tag that returns alphanumeric characters can be used in a text comparison condition. Use only the name of the tag to specify a condition. For example:

CurrentDate.gte.10/10/96

ClientPassword.eq.password_name

Fieldname.cn.literal_value


Previous topic | Contents | Next topic