AMBIGUOUS function
- Last Updated: January 18, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Returns a TRUE value if the last FIND statement for a
particular record found more than one record that met the specified index criteria.
Syntax
|
- record
- The name of a record or record buffer used in a previous
FINDstatement.To access a record in a table defined for multiple databases, you might have to qualify the record's table name with the database name. See the record definition in the Record phrase reference entry for more information.
Examples
The following example retrieves a customer record based on a name
(cname) supplied by the user. If the procedure finds a record, it
displays fields from that record. If it does not find a record because more than one record
matched the selection criteria (name = cname), it displays the message:
"There is more than one customer with that name". If it does not find a
record because no records matched the selection criteria, it displays "Cannot find
customer with that name".
r-ambig.p
|
Sometimes the AMBIGUOUS function returns a TRUE value when
there is no ambiguity. For example, if there is exactly one customer record, the following
statement finds that record. Otherwise, the statement always returns a message of "not
found" rather than ambiguous:
|
Additionally, the following statement succeeds if there is only one
Smith listed in the database:
|
If the FIND statement contains a BEGINS operator with a
string, where multiple records have that field beginning with such string, and one of the
fields matches the string exactly, that record is returned and is not considered an
ambiguous request. For example:
|
In this example, FIND returns the record where myField is
"Run" even if another record contains "Running" in that
field.
Notes
AMBIGUOUSis useful only when there is an index. If you use theAMBIGUOUSfunction to test a work file record, the function returns a value of FALSE because work files do not have indexes.
See also
AVAILABLE function, FIND statement, LOCKED function, NEW function (record buffers)