Returns a TRUE value if the last FIND statement for a particular record found more than one record that met the specified index criteria.
AMBIGUOUS recordTo 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 phrase reference entry for more information.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”.
DEFINE VARIABLE cName NO-UNDO LIKE Customer.Name LABEL "Cust Name".REPEAT:SET cName.FIND Customer NO-LOCK WHERE Customer.Name = cName NO-ERROR.IF AVAILABLE Customer THENDISPLAY Customer.CustNum Customer.Address Customer.City Customer.StateCustomer.PostalCode.ELSE IF AMBIGUOUS Customer THENMESSAGE "There is more than one customer with that name".ELSEMESSAGE "Cannot find customer with that name".END.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 following statement always returns a message of “not found” rather than “ambiguous”:
FIND Customer WHERE Customer.Name BEGINS "".
FIND Employee WHERE Employee.LastName = "Smith"AND Employee.FirstName BEGINS "".AMBIGUOUS is useful only when there is an index. If you use the AMBIGUOUS function to test a work file record, the function returns a value of FALSE because work files do not have indexes.
© 2012 Progress Software Corporation and/or its subsidiaries or affiliates. |