OnlyOneOrNone function

Syntax

OnlyOneOrNone(fieldlist)

where fieldlist is an arbitrary-length list of fields in the form:

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

Description

Use the OnlyOneOrNone function to check a list of fields and return True if either of these conditions is true:

  • Only one of the fields has a value.

  • None of the fields has a value.

This function is useful when you have a set of mutually exclusive fields in a page and the entire set of fields is optional. The end user can leave all the fields blank or enter a value in one of the fields only.

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

Example

You typically use OnlyOneOrNone as follows:

If OnlyOneOrNone(param_one, param_two)
   Then value_a = "y";
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.

AllOrNone function

Checks if either all the field parameters have values, or none of them have values. Use this in examples where if the user fills in one field, she must fill in all the other related values.

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.