Next - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Result

 Next
 move the cursor to the next row

 Calling Sequence result:-Next( )

Parameters

 result - Result module

Description

 • Next moves the row cursor maintained within result to the next row in the table.
 • If the new Row is a valid row containing table data, Next returns true.  If the new row is beyond the end of the table, Next returns false.
 • In a newly created Result module the row cursor is on the row before the first row containing data.  Therefore a call to Next is required to read data from the first row.
 • The row cursor can be moved back using the Previous command.

Examples

Create a Result.

 > $\mathrm{driver}≔{\mathrm{Database}}_{\mathrm{LoadDriver}}\left(\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left(\mathrm{url},\mathrm{name},\mathrm{pass}\right):$$\mathrm{res}≔\mathrm{conn}:-\mathrm{ExecuteQuery}\left("SELECT name FROM animals"\right):$

Since Next must be called before the first row of data can be accessed, it works as the condition of a while loop.

 > $\mathbf{while}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{res}:-\mathrm{Next}\left(\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{res}:-\mathrm{GetData}\left(1\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}$
 ${"fish"}$
 ${"dog"}$
 ${"cat"}$
 ${"rat"}$
 ${"horse"}$
 ${"snake"}$
 ${"lizard"}$
 ${"parrot"}$
 ${"pig"}$
 ${"hamster"}$ (1)