Override for the _getData method of the Table Data Model.
/* This is a method override for the _getData method of the Table
* Data Model, which provides the table editor with contents of the
* data to be displayed. Parameters passed to this method:
* 'gddvecid' - Use instance of the GET_DATA data vector class.
* The data vector is filled in with the contents
* of the requested row.
* data vector for 'num_cols'.
* 'num_cols' - The number of columns to retrieve from the
* requested row. */
GETDATA: method gddvecid num_cols 8;
/* Retrieve the value of the instance variable DATABASE
* which contains the information for this multi-dimensional example.
* From the DATABASE list, retrieve the ROWS sublist which
* contains the information about the rows. Within the ROWS
* list, the rows are stored in order starting at the beginning
* of the list. For example, the first row, 1998, in the
* ROWS list is the first row to display in the table editor.*/
database = getniteml( _self_, 'DATABASE' );
rowlst = getniteml( database, 'ROWS' );
/* Use the _getRow method of the GET_DATA Data Vector to retrieve
* which row is currently being requested by the table editor for
* display. */
coords = makelist();
call send( gddvecid, '_getRow', coords );
/* Get the top-level row dimension from the COORDS list */
rownum = getitemn( coords, 1 );
/* Get the second-level row dimension from the COORDS list */
subrownum = getitemn( coords, 2 );
/* The COORDS list is no longer needed. Delete the COORDS list. */
coords = dellist( coords );
/* Using the top-level row dimension(ROWNUM), retrieve the
* top-level dimension list from ROWS. Then using the
* second-level row dimension(SUBROWNUM), get the second-level
* list from the top-level list. For example, if
* ROWNUM is 1, then the sublist 1998 would be retrieved
* from the ROWS list. If SUBROWNUM is 3, then the sublist
* 'Quarter 3' would be retrieved. */
rowlst = getiteml( rowlst, rownum );
rowlst = getiteml( rowlst, subrownum );
/* From the second-level list retrieve the value for each of the
* passed columns. For each requested column:
* (1) Get the column coordinates
* (2) Get the column text
* (3) Set the text in gddvecid */
colcoords = makelist();
do i = 1 to num_cols;
/* Each time through the loop, we need to set the index for the
* the current column in gddvecid. Then get the column
* coordinates for that column. */
call send( gddvecid, '_setIndex', i );
call send( gddvecid, '_getColumn', colcoords );
/* Get the top-level and second-level column dimensions from the
* COLCOORDS list. */
colnum = getitemn( colcoords, 1 );
subcolnum = getitemn( colcoords, 2 );
/* Calculate where to retrieve the data */
colnum = colnum * 2 - mod( subcolnum, 2 );
/* Retrieve the data and convert it to a character string. */
text = trim(left(put(getitemn(rowlst, colnum), 12. )));
/* Set the data in gddvecid */
call send ( gddvecid, '_setText', text );
end;
/* The COLCOORDS list is no longer needed. Delete the COLCOORDS list. */
colcoords = dellist( colcoords );
endmethod;