Function documentation__getitem__ Method (SapDB_ResultSet Class) Locate this document in the navigation structure


__getitem__ is a method of the SapDB_ResultSet class (sdb.sql module). You can use this method to position the cursor on a data record in the result set and to iterate through all the data records in the result set in a for loop.


Syntax Syntax

  1. __getitem__ (pos)
End of the code.
__getitem___ Method: Attributes




Position of the data record

pos=0: First data record in the result set

  • Data record at the specified position in the result set

  • If the result set is empty or if pos exceeds the number of data records in the result set: None


You iterate through the entire result set using for. The system implicitly calls the __getitem__ method and raises the value of the pos parameter in increments of 1 until the method triggers an exception.

Syntax Syntax

  1. for zip, name, state in session.sql ('SELECT * FROM'):
      print zip, name, state
End of the code.