Name

RecordSet.getLength( ) Method

Synopsis

                     myRecordSet.getLength( )

Returns

An integer specifying the number of rows in the RecordSet object.

Description

The getLength( ) method returns an integer that contains the number of rows in the RecordSet object. This length is always be one more than the highest index number in the recordset. For example, a recordset that has 10 rows with index numbers from 0 to 9 has a length of 10.

Example

The following code gets the length of the RecordSet object and puts it into a variable:

var myRecordsetLength = myRecordset_rs.getLength( );

The length is typically used to loop through all records in a recordset, such as:

var myRecordsetLength = myRecordset_rs.getLength( );
for (var i; i < myRecordsetLength; i++) {
  trace(myRecordset_rs.getItemAt(i));
}

See Also

Chapter 4, “Loops and Repeated Operations” in Chapter 12

Get Flash Remoting: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.