Found Global Variable

See Also: Global Variables Used by Data Dictionaries, Constrained_Find, Constraint_Validate, Find, Open, Vfind

Purpose

To indicate the success or failure of the last find.

Type

Boolean

What It Does

Whenever a Find command is executed, the Found predefined indicator is set. If the find is successful, Found is set True. If the find is unsuccessful, Found is set False. This allows you to program the appropriate action when a find command finds a record.

Clear Parts

Move 25 to Parts.Code

Find eq Parts.Code

If (Found) Send DoUpdate

If a record in the Parts table is found with the value of Parts.Code code equalling the value in the buffer (25 in this sample), Found is True and the DoUpdate method is called.

Notes

Example

Clear Parts

Repeat

Find gt Parts.Code

    If (Found) Begin

        // do something else

    End

Until Not (Found)

The sample code above attempts to loop through all records in the Parts table. The problem is that code executed inside the if (Found) begin...end block of code may change the value of Found. If the value of Found is changed to False by the use of another command or message, this could result in the loop ending before all records have been processed by the loop.

The sample code below solves this problem by resetting the value of Found to True at the end of the if (Found) begin...end block of code, ensuring that the loop will continue after any find gt that successfully finds a record.

Clear Parts

Repeat

Find gt Parts.Code

    If (Found) Begin

        // do something else

        Move True to Found  // reset Found for repeat...until loop

    End

Until Not (Found)