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

# Online Help

###### All Products    Maple    MapleSim

Result

 Previous
 move the cursor to the previous row

 Calling Sequence result:-Previous( )

Parameters

 result - Result module

Description

 • Previous moves the row cursor maintained within result to the previous row in the table.
 • If the new Row is a valid row containing table data, Previous returns true.  If the new row is before the first row of the table, Previous returns false.
 • The row cursor can be moved forward using the Next 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):$

Move the cursor to the end of the table.

 > $\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}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}:$

Now inspect the table backwards.

 > $\mathbf{while}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{res}:-\mathrm{Previous}\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}:$
 ${"hamster"}$
 ${"pig"}$
 ${"parrot"}$
 ${"lizard"}$
 ${"snake"}$
 ${"horse"}$
 ${"rat"}$
 ${"cat"}$
 ${"dog"}$
 ${"fish"}$ (1)

 See Also