SEARCH-TEXT (alphanumeric)

When you assign this property, the grid initiates a search using the current search options. The program looks for the value assigned to this property. The search starts in the cell identified by the X and Y properties, unless overridden by the GRID-SEARCH-SKIP-CURRENT described under SEARCH-OPTIONS. If the search is successful, X and Y are updated to reflect the cell found. The return value of this property is the status of the search:

GRDSRCH-NOT-FOUND (value 0) No matching data found
GRDSRCH-FOUND (value 1) Search succeeded
GRDSRCH-WRAPPED (value 2) Search succeeded but had to wrap

If X and Y identify a cell outside of the range of cells, the starting cell is determined as if the search wrapped from the logical (X,Y) location. For example, if the starting point is a cell past the right-most cell, a forward search starts at the first cell of the next row. You can use this to force a search of the entire grid by starting a forward search at row 0, or a backward search from a row that is past the end of the grid's data.

The following sample code searches a grid for the word "science," starting at the cell where the cursor is currently located:

INQUIRE GRID-1, CURSOR-X IN CUR-COL,
                CURSOR-Y IN CUR-ROW
MODIFY GRID-1 (CUR-ROW, CUR-COL) 
SEARCH-TEXT = "science" GIVING RESULT-1
IF RESULT-1 > GRDSRCH-NOT-FOUND
    DISPLAY MESSAGE BOX "Search succeeded".

The grid's search facility does not contain a user interface. You must supply one if you want to give the user a search function. One typical interface is a pop-up dialog box in which the user can set the search text and options desired. Another typical interface is an entry field in the same window as the grid, with a Find button beside the entry field.