Accessing data in recordsets
Once we have a recordset, we want to inspect the data contained in it. So, in the following sections, we will explore how to access data in recordsets.
We can get field values for individual records called singletons. Relational fields have special properties, and we can use dot-notation to navigate through linked records. Finally, we will discuss some considerations for when we need to handle date and time records and convert them between different formats.
Accessing individual record data
When a recordset has only one record it is called a singleton. Singletons are still recordsets and can be used wherever a recordset is expected.
But unlike multi-element recordsets, singletons can access their fields using dot-notation, as follows:
>>> print(self.name) OdooBot
In the next example, we can see that the same self
singleton recordset also behaves as a recordset, and we can iterate it. It has only one record, so only one name is...