GetRowIndex - Maple Help

Home : Support : Online Help : Connectivity : Database Package : Result : Database/Result/GetRowIndex

Result

 GetRowIndex
 get the row index of the current row

 Calling Sequence result:-GetRowIndex( )

Parameters

 result - Result module

Description

 • GetRowIndex returns the index of the current row.  Row indices range from $1$ to $n$, where $n$ is the total number of rows in the table.
 • If the current row is not a row containing data (the row before the first row, or the row after the last row) GetRowIndex returns 0.
 • GotoRow can be used to move to a row whose index was returned by GetRowIndex.
 • Deleting or inserting rows in the table may change the indices of rows. Do not assume that indices received before such an operation will index the same rows after.

Examples

Create a Result.

 > $\mathrm{driver}≔\mathrm{Database}\left[\mathrm{LoadDriver}\right]\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):$$\mathrm{res}:-\mathrm{GetRowIndex}\left(\right)$
 ${0}$ (1)
 > $\mathbf{while}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{res}:-\mathrm{Next}\left(\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{res}:-\mathrm{GetRowIndex}\left(\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}$
 ${1}$
 ${2}$
 ${3}$
 ${4}$
 ${5}$
 ${6}$
 ${7}$
 ${8}$
 ${9}$
 ${10}$ (2)
 > $\mathrm{res}:-\mathrm{GetRowIndex}\left(\right)$
 ${0}$ (3)