RecordSet.getItemAt( )

RecordSet.getItemAt( ) MethodFlash 6

returns the record at a given index number
myRecordSet.getItemAt(index)

Arguments

index

An integer between 0 and the length of the RecordSet object minus one.

Returns

A row (i.e., a single record) of the RecordSet object.

Description

The getItemAt( ) method returns a full row of a recordset. The return value is a single record from the recordset, represented as an associative array whose keys correspond to the recordset's column names. You can retrieve individual fields by name from the row returned by this method.

Example

The following code returns a row of the recordset and then sets variables to the value of each field in the record:

var myRow = myRecordset.getItemAt(0);
var myFirstName = myRow.FirstName;
var myLastName = myRow.LastName;
myTextField.text = "Hello " + myFirstName + " " + myLastName;

Individual fields can also be accessed through associative array notation, as in this example:

var myRow = myRecordSet.getItemAt(0);
var myFirstName = myRow["FirstName"];

See Also

RecordSet.addItemAt( ), RecordSet.getColumnNames( ), RecordSet.replaceItemAt( ); Chapter 4



    Part III: Advanced Flash Remoting