Find method: Rowset class

Syntax

Find(search_string, row_number)

Description

Use the Find method to search for a string value in a rowset starting at row_number, if specified.

The Find operation is case-insensitive. It is a full-match search, that is, the search checks field values containing the entire string passed to the Find method. For example, searching on the string dict returns the field whose value is dictionary. However, partial matches aren't recognized. For example, searching on the string position does not consider a field value of Pos to be a match.

Parameters

Parameter Description

search_string

Specifies the text to search as a String.

row_number

This parameter is optional.

Specifies the row number to start the search. Specify 1 to initiate the search in the first row of the rowset. If the given row number is beyond the rowset bounds then the search starts at the first row.

If the row number is not specified, search starts from the row where the previous Find operation completed. If this is the first search, then the search starts at the first row.

Returns

A Field Class object whose value contains the string. Null if the search string is not found.

Example

Local Rowset &rs = GetRowset(Scroll.PS_FLUID_SA);
Local Field FieldObject = &rs.Find("String to Find");
if All(FieldObject) then /* found */
      /* 1. Application makes sure that the field can be properly accessed: */
      /*    move scroll area rows into position or expand collapsed groupboxes etc. */
     FieldObject.FindDisplay = true; 
     /* re-renders the field with new attributes (unless already editable) and sets focus */
     /* re-renders last field found without the additional attributes, if any */
else
      MessageBox("String not found");
end-if;

Restrictions of the Find Method in Rowset

Consider the following restrictions of the Find method:

  • Only the first instance of a string in a row is found.

  • It searches for matches in edit boxes, display-only fields, disabled fields, dynamic links, and text in long edit boxes.

  • It searches for matches in individual fields, so it does work on related display fields that are usually a combination of multiple field values. For example, if a related display field combines the country code (USA) with the country description (United States), then a search string of USA United States does not find a match. However, a search for USA or United States does find a match.

  • It ignores fields in HTML areas.

  • It does not find column headings, field labels, text values in icons, static links, and hidden fields.

  • It works on a rowset that exists on the current page. Returns a null value if the rowset does not exist on the current page.

  • It only works on Component Buffer rowsets. All rows in the rowset must be loaded into the component buffer, not necessarily displayed though.

  • It does not work on Standalone rowsets, Message rowsets, Component Interface rowsets or Application Engine rowsets. Also, it does not work with the TopLevel rowset as it doesn’t represent a scroll.

  • It does not work on a fluid grid that uses lazy scrolling.

  • After finding a match, the Find method does not attempt to set the focus on the field or scroll the row into view because it may alter the expected display of the page. So, application developers should ensure that the user interface is updated with the result of the Find operation or use the FindDisplay property of the Field class.

    Note:

    The Find method does not change the focus nor does it set or clear the FindDisplay property on a field.