Chapter Contents

Previous

Next
Data Set Model: _fetchRow

Data Set Model: _fetchRow



Reads a row from the table


Syntax
Details
Example

Syntax

CALL SEND (object-id, '_fetchRow', row-num<, eod>);

Argument Type Description
row-num
N specifies the relative row number to be read. This row becomes the current row.
eod
N returns whether the end of the data has been reached


1 end of data has been reached


0 more records are to be read


Details

If you modify the current row in the table, you must use the _updateRow method before calling the _fetchRow method.

The _fetchRow method uses the last Data Set Data Vector. You cannot call the _fetchRow method until you pass a Data Set Data Vector instance to another method of this object, such as the _getRow method.

The _fetchRow method sets SYSRC for error, note, and warning conditions.


Example

In the following example, the Data Set Model class is being used as a stand-alone model, that is, the model class is not being used with a data form or data table object. This example is written as a stand-alone SCL entry.

Note:   You would not use this same code with a data form or data table object because in that case, the model has already been initialized for you.  [cautionend]

length name $ 32;
 Note about code
INIT:
   datid = instance( loadclass
                    ( 'sashelp.fsp.datast_m.class' ) );
   dsdvec = instance( loadclass
                    ( 'sashelp.fsp.dsdvec.class' ) );
 Note about code
   call send( datid, '_setDataset',
             'sasuser.class' );

   call send( datid, '_getNumberOfColumns',
              ncols );
   call send( dsdvec, '_setNumberOfColumns',
              ncols, datid );
 Note about code
   wlst = makelist();
   wlst = insertc( wlst, 'sex="M"', -1);
   wlst = insertc( wlst, 'and height > 60', -1);
   call send( datid, '_setWhere', wlst );
   wlst = dellist( wlst );
 Note about code
   row = 1;
   call send( datid, '_getRow',
              dsdvec, row, eod );
 Note about code
   do while( not eod );
 Note about code
      call send( datid, '_getColumnText',
                'NAME', name );
      call send( datid, '_getColumnValue',
                'height', height );
      put name= height=;
 Note about code
      row + 1;
      call send( datid, '_fetchRow',
                 row, eod );
   end;
 Note about code
   if ( row = 1 ) then
      put 'No rows meet the WHERE clause criteria';
return;
 Note about code
TERM:
   call send( dsdvec, '_term' );
   call send( datid, '_term' );
return;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.