[Stackoverflow] [Progress OpenEdge ABL] When to use FIND FIRST and when to use FOR FIRST

Status
Not open for further replies.
R

Raphael Frei

Guest
My company has a lot of codes using FIND FIRST to get the first register (Searching on a UNIQUE Field).

But while learning more about Progress, several places recomends me to search with FOR FIRST instead, by saying that FIND FIRST may not be finding the first register with the same value.

By saying that I need to find the first value using a unique field, does it really make a difference between these two? Besides not needing to check if the field is available

Code:
FOR FIRST file_path WHERE file_path.file_name = "ABCDEF" NO-LOCK:
    // Do my thing
END.

Code:
FIND FIRST file_path WHERE file_path.file_name = "ABCDEF" NO-LOCK NO-ERROR.

IF AVAIL file_path THEN DO:
    // Do my thing
END.

The only issue that I found by using FOR FIRST is not being to use IF NOT AVAIL in case of no records are available.

Continue reading...
 
Status
Not open for further replies.
Top