====== Fields ====== All items, working with database table data have a :doc:`fields ` attribute - a list of field objects, which are used to represent fields in item's table records. Every field have the following attributes: .. csv-table:: :header: Client, Server, Description :widths: 10, 10, 80 :doc:`owner `, :doc:`owner `, "The item that owns this field." :doc:`field_name `, :doc:`field_name `, "The name of the field that will be used in programming code to get access to the field object." :doc:`field_caption `, :doc:`field_caption `, "The name of the field that appears to users." :doc:`field_type `, :doc:`field_type `, "Type of the field, one of the following values: **text**, **integer**, **float**, **currency**, **date**, **datetime**, **boolean**, **blob**." :doc:`field_size `, :doc:`field_size `, "A size of the field with type **text**" :doc:`required `, :doc:`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: .. csv-table:: :header: Client, Server, Description :widths: 10, 10, 80 :doc:`value `, :doc:`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." :doc:`text `, :doc:`text `, "Use this property to get or set the value of the field as text." :doc:`lookup_value `, :doc:`lookup_value `, "Use this property to get or set lookup value, see :doc:`Lookup fields `." :doc:`lookup_text `, :doc:`lookup_text `, "Use this property to get or set the lookup value of the field as text, see :doc:`Lookup fields `." :doc:`display_text `, :doc:`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 :doc:`on_field_get_text ` event handler of the item that owns the field." :doc:`raw_value `, :doc:`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`` .. code-block:: js 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 :doc:`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