AllOrNone function

Syntax

AllOrNone(fieldlist)

Where fieldlist is an arbitrary-length list of field references in the form:

[recordname.]fieldname1 [, [recordname.]fieldname2] ...

Description

The AllOrNone function takes a list of fields and returns True if either of these conditions is true:

  • All of the fields have values (that is, are not Null).

  • None of the fields has a value.

For example, if field1 = 5, field2 = "Mary", and field3 = null, AllOrNone returns False.

This function is useful, for example, where you have a set of page fields, and if any one of the fields contains a value, then all of the other fields are required also.

A blank character field, or a zero (0) numeric value in a required numeric field is considered a null value.

Returns

Returns a Boolean value: True if all of the fields in fieldlist or none of the fields in fieldlist has a value, False otherwise.

Example

You could use AllOrNone as follows:

If Not AllOrNone(STREET1, CITY, STATE) Then
   WinMessage("Address should consist of at least Street (Line 1), City, State,⇒
 and Country.");
End-if;

Related Functions

Function Description

All function

Checks to see if a field contains a value, or if all the fields in a list of fields contain values. If any of the fields is Null, then All returns False.

None function

Checks that a field or list of fields have no value.

OnlyOne function

Checks if exactly one field in the set has a value. Use this when the user must fill in only one of a set of mutually exclusive fields.

OnlyOneOrNone function

Checks if no more than one field in the set has a value. Use this in examples when a set of fields is both optional and mutually exclusive; that is, if the user can put a value into one field in a set of fields, or leave them all empty.