Difference between revisions of "ABROWSE()"
Helengeorge (Talk | contribs) (→Class) |
Yvonnemilne (Talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Function to browse a two-dimensional array in a spreadsheet style format | Function to browse a two-dimensional array in a spreadsheet style format | ||
Line 10: | Line 8: | ||
==See Also== | ==See Also== | ||
− | [[AADD()]], [[AAVERAGE()]], [[ACHOICE()]], [[ACOL()]], [[ACOPY()]], [[ADEL()]], [[ADESC()]], [[ADIR()]], [[AELEMENT()]], [[AFIELDS()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[AROW()]], [[ASCAN()]], [[ASIZE()]], [[ASORT()]], [[ASTORE()]], [[ASTRING()]], [[ASUBSCRIPT()]], [[ASUM()]], [[COPY TO ARRAY]], [[DBEDIT()]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]] | + | [[AADD()]], [[AAVERAGE()]], [[ACHOICE()]], [[ACOL()]], [[ACOPY()]], [[ADEL()]], [[ADESC()]], [[ADIR()]], [[AELEMENT()]], [[AFIELDS()]], [[AFILL()]], [[AINS()]], [[ALEN()]], [[AMAX()]], [[AMIN()]], [[APPEND FROM ARRAY]], [[AROW()]], [[ARRAY()]], [[ASCAN()]], [[ASIZE()]], [[ASORT()]], [[ASTORE()]], [[ASTRING()]], [[ASUBSCRIPT()]], [[ASUM()]], [[COPY TO ARRAY]], [[DBEDIT()]], [[DECLARE]], [[DIMENSION]], [[GATHER]], [[IN_ARRAY()]], [[IS_ARRAY()]], [[LOCAL]], [[PRIVATE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SCATTER]] |
− | + | ||
==Description== | ==Description== | ||
Line 95: | Line 92: | ||
return ab_action | return ab_action | ||
− | + | declare employees read only cursor for select * from emp | |
− | + | open employees | |
− | + | fetch employees into array ora_rows, ora_headings | |
− | + | close employees | |
− | + | drop cursor employees | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
clear | clear | ||
set pckeys on | set pckeys on | ||
Line 113: | Line 104: | ||
==Products== | ==Products== | ||
− | Recital | + | Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:Array Processing]] | [[Category:Array Processing]] | ||
[[Category:Array Processing Functions]] | [[Category:Array Processing Functions]] |
Latest revision as of 15:45, 5 July 2011
Contents
Purpose
Function to browse a two-dimensional array in a spreadsheet style format
Syntax
ABROWSE(<expN1>, <expN2>, <expN3>, <expN4>, <expC1> [,<expC2>] [,<expC3>] [,<expC4>]
See Also
AADD(), AAVERAGE(), ACHOICE(), ACOL(), ACOPY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMIN(), APPEND FROM ARRAY, AROW(), ARRAY(), ASCAN(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COPY TO ARRAY, DBEDIT(), DECLARE, DIMENSION, GATHER, IN_ARRAY(), IS_ARRAY(), LOCAL, PRIVATE, PUBLIC, RELEASE, RESTORE, SAVE, SCATTER
Description
The ABROWSE() function browses a two dimensional array in a spreadsheet style format. This function is particularly useful with arrays that have been FETCHED or LOADED from SQL tables from a remote server.
The coordinates of the spreadsheet are defined with expressions <expN1> and <expN2>, which represent starting and ending row and column numbers respectively. The expression <expC1> is the name of the two dimensional array to be browsed. By default, only the [ABANDON] and [EXIT SAVE] keys and the cursor navigation keys are active within ABROWSE(). The cursor navigation keys are [CURSOR LEFT], [CURSOR RIGHT], [CURSOR UP], [CURSOR DOWN], [PAGE UP] and [PAGE DOWN]. The optional expression <expC2> is the name of a User Defined Function (UDF) to handle any other keystrokes. Note: if a UDF is specified, it will also trap the [ABANDON] and [EXIT SAVE] keys, so provision should be made to allow exit from the ABROWSE().
The AROW() and ACOL() functions return array row and column coordinates for use inside the UDF. When not used as part of a UDF, the AROW() and ACOL() functions can provide coordinates to edit the array. Two parameters are passed to the UDF: the current ABROWSE() status (see the table below) and the current column number starting from column 1.
UDF Parameters
Status | Description |
---|---|
0 | ABROWSE() is idle, no keystrokes are pending. |
1 | An attempt was made to move beyond the top of the array. |
2 | An attempt was made to move beyond the bottom of the array. |
3 | The array is empty. |
4 | A key other than a cursor navigation key was pressed. The LASTKEY() function can be used to check the key pressed. |
UDF Return Values
The UDF must return one of the following values:
Value | Description |
---|---|
0 | Quit ABROWSE(). |
1 | Continue ABROWSE(). |
2 | Reread data, repaint the screen and continue. |
The ABROWSE() function handles picture formatting for each column in the spreadsheet with an array represented by the optional expression <expC3>. Each value in array <expC3> should contain a picture formatting expression that corresponds to a column in array <expC1>.
Column headings may be optionally specified for the spreadsheet by using an array specified with <expC4>. Each value in array <expC4> should contain a column heading that corresponds to a column in array <expC1>.
Example
function ab_udf parameters ab_status, ab_col do case case ab_status = 0 ab_action = 1 case ab_status = 1 @0,0 clear to 0,79 @0,0 say "Attempt to move past the top of file." ab_action = 1 case ab_status = 2 @0,0 clear to 0,79 @0,0 say "Attempt to move past the end of file." ab_action = 1 case ab_status = 3 && array is empty ab_action = 0 case ab_status = 4 do case case lastkey() = 27 ab_action = 0 case lastkey() = 13 @0,0 clear to 0,79 m_get = ora_rows[arow(), acol()] @0,0 get m_get ora_rows[arow(), acol()] = m_get ab_action = 2 otherwise @0,0 clear to 0,79 @0,0 say "ASCII of key pressed is str(lastkey(),3)" ab_action = 1 endcase otherwise ab_action = 1 endcase return ab_action declare employees read only cursor for select * from emp open employees fetch employees into array ora_rows, ora_headings close employees drop cursor employees clear set pckeys on abrowse(1,1,23,78,ora_rows,"ab_udf",,ora_headings)
Products
Recital