Moves a query object's result list pointer ahead one row.

Return type: LOGICAL

Applies to: Query object handle

Syntax

GET-NEXT ( NO-LOCK | SHARE-LOCK [ , NO-WAIT ]
| EXCLUSIVE-LOCK [ , NO-WAIT ]  )
NO-LOCK
Specifies that no lock is applied to the record. This applies to all buffers in a join. Unless explicitly specified otherwise, this is the default lock type for this method.
SHARE-LOCK
Specifies that the record is share locked. This applies to all buffers in a join.
EXCLUSIVE-LOCK
Specifies that the record is exclusively locked. This applies to all buffers in a join.
NO-WAIT
Specifies that the method returns immediately if the record cannot be accessed because it is locked by another user. If you do not use the NO-WAIT option, the method waits until the record can be accessed. This applies to all buffers in a join. If you specify NO-WAIT and the record is locked by another user, the record is returned to you with NO-LOCK and the LOCKED function returns TRUE for the record.

Example

DEFINE VARIABLE hQuery AS HANDLE  NO-UNDO.
DEFINE VARIABLE iCount AS INTEGER INITIAL 0 NO-UNDO.

CREATE QUERY hQuery.

hQuery:SET-BUFFERS(BUFFER Customer:HANDLE).
hQuery:QUERY-PREPARE("FOR EACH Customer").
hQuery:QUERY-OPEN.

hQuery:GET-FIRST().
MESSAGE "First Customer is" NAME.

DO WHILE NOT hQuery:QUERY-OFF-END:
  iCount = iCount + 1.
  hQuery:GET-NEXT().
END.
MESSAGE "Total number of Customer is" iCount.

hQuery:QUERY-CLOSE().
DELETE OBJECT hQuery.

Notes

  • GET-NEXT() returns TRUE if the next record in the query is found. If the query is not open or the next record cannot be found (query is empty or the query result list pointer is on the last row), the method returns FALSE. If the query object handle is invalid, an error is raised.
  • When you execute an OPEN QUERY or REPOSITION statement for a query associated with a browse widget, the browse is automatically adjusted to remain in sync with the query. However, when you execute a GET statement or method, the browse is not adjusted. You can use the GET statement, or one of the GET methods (GET-CURRENT/FIRST/LAST/NEXT/PREV) to perform background processing without affecting the browse, but you must execute a REPOSITION statement or one of the REPOSITION methods (REPOSITION-BACKWARD/FORWARD/TO-ROW/TO-ROWID) to put the query and browse back in sync.
  • GET-NEXT() does the same action as GET-FIRST() if it is the first GET call after a query is opened.