Jam.py documentation

Fields

All items, working with database table data have a fields attribute - a list of field objects, which are used to represent fields in item’s table records.

Every field have the following attributes:

Client Server Description
owner owner The item that owns this field.
field_name field_name The name of the field that will be used in programming code to get access to the field object.
field_caption field_caption The name of the field that appears to users.
field_type field_type Type of the field, one of the following values: text, integer, float, currency, date, datetime, boolean, blob.
field_size field_size A size of the field with type text
required required Specifies whether a nonblank value for a field is required.

To get access to the item dataset data, the Field class have the following properties:

Client Server Description
value value Use this property to get or set the field’s value of the current record. When reading the value is converted to the type of the field. So for fields of type integer, float and currency, if value for this field in database table record is NULL, value of this property is 0. To get unconverted value use the raw_value property.
text text Use this property to get or set the value of the field as text.
lookup_value lookup_value Use this property to get or set lookup value, see Lookup fields.
lookup_text lookup_text Use this property to get or set the lookup value of the field as text, see Lookup fields.
display_text display_text Represents the field’s value as it is displayed in data-aware controls. When the field is a lookup field it’s value is the lookup_text value, otherwise it is the text value, with regard of project locale parameters. This behavior can be overridden by the on_field_get_text event handler of the item that owns the field.
raw_value raw_value Use this property to get field value of the current record as it is stored in database. No conversion is used.

In addition every field is an attribute of the item that owns it. So, to get access to a field of an item use the following syntax: item.field_name

invoices.total.value

invoices.total is the reference to the Total field of the Invoices item and the invoices.total.value is the value of this field

Below are the values of the attributes of the fields of the invoices item in the Demo project

customer integer
   value:  2
   text:  2
   lookup_value:  Köhler
   lookup_text:  Köhler
   display_text:  Leonie Köhler
firstname integer
   value:  2
   text:  2
   lookup_value:  Leonie
   lookup_text:  Leonie
   display_text:  Leonie
billing_address integer
   value:  2
   text:  2
   lookup_value:  Theodor-Heuss-Straße 34
   lookup_text:  Theodor-Heuss-Straße 34
   display_text:  Theodor-Heuss-Straße 34
id integer
   value:  1
   text:  1
   lookup_value:  None
   lookup_text:
   display_text:  1
date date
   value:  2014-01-01
   text:  01/01/2014
   lookup_value:  None
   lookup_text:
   display_text:  01/01/2014
total currency
   value:  2.08
   text:  $2.08
   lookup_value:  None
   lookup_text:
   display_text:  $2.08