Description:
Reset a cursor by moving it back to the beginning.
Syntax:
cs.reset()
Note:
The function resets a cursor by moving it back to the beginning when it traverses cursor data to the end.
Note: Cursors returned from certain functions are irreversible, including db.cursor@x(), f.cursor@x(), cs.groupx(), cs.sortx(), cs.joinx() and cursor(spl,…).
Parameter:
cs |
A cursor |
Return value:
Cursor
Example:
|
A |
|
1 |
=demo.cursor("select * from scores") |
Return retrieved data as a cursor. |
2 |
=A1.fetch() |
Fetch data from the cursor.
|
3 |
=A1.fetch() |
Return null because A1’s cursor has come to the end of the data. |
4 |
=A1.reset() |
Move the cursor back to the beginning. |
5 |
=A1.fetch() |
Fetch data out of the cursor; returned result is the same as A2. |
Related function: