1. FINDSET :
- Retrieves set of records.
- Transaction begins with FINDSET Command.
2. FINDFIRST :
- It will retrieve the first record
- Retrieves only 1 record, the last one within filter, sorted accordingly.
- Transactions begins when a call to update the database. (Insert, modify, delete).
- Opens the connection with database
- fetches the record from database
- closes the connection
Example:
IF EmployeeVar.FINDFIRST THEN
MESSAGE('employee no. %1',EmployeeVar."Employee No.");
Since we are not repeating the process its better to use FINDFIRST if you're fetching only one time from the database.
3. FIND('-') :
- It will also retrieve the first record
- Retrieves only 1 record, the last one within filter, sorted accordingly.
- Transactions begins when a call to update the database. (Insert, modify, delete).
- Opens the connection with database
- fetches the record from database
- doesn't close the connection until the condition is false.
IF EmployeeVar.FIND('-') THEN
REPEAT
MESSAGE('employee no. %1',EmployeeVar."Employee No.");
UNTIL EmployeeVar.NEXT=0;
Since we are repeating the process its better to use FIND('-'), it will work fine even if we use FINDFIRST but each time it retrieves the record it opens the connection and before fetching next record it closes the connection. Which reduces performance.
So, it better to use FIND('-) for repeated retrieval of record.