Please enable JavaScript to view this site.

ESL Documentation

This section illustrates the use of the find action statement to perform global changes in a table. Note that the find command sets the current cell, but does not scroll the table. This example restores the cursor when it is done.

 

# Example of using find to loop through a table

 

integer OldX_IV OldY_IV Count_IV Row_IV

 

action RaiseSalary is

  # Give a 25% salary increase to all people who match the

  # find criteria.

 

  # Save the original cursor location.

  copy (xcursor of Employees_TBL) to OldX_IV

  copy (ycursor of Employees_TBL) to OldY_IV

 

  # Find the first match, from the top of the table.

  find in column FirstName of Employees_TBL from row 1

      complete "Eric" # Find all with this first name

  copy 0 to Count_IV

 

  while (found) loop ProcessFind

    copy (ycursor of Employees_TBL) to Row_IV

    copy (1.25 * cell Salary, Row_IV of Employees_TBL)

        to cell Salary, Row_IV of Employees_TBL

    copy (Count_IV + 1) to Count_IV

 

    find in column FirstName of Employees_TBL from next

        complete "Eric"

  end loop ProcessFind

  # Count_IV has the number of matches found.

 

  # Restore the cursor location.

  change Employees_TBL cursor to OldX_IV OldY_IV