=====
value
=====

.. py:attribute:: value

**domain**: server

**language**: python

:doc:`Field class </refs/server/field_api>`

Description
===========

Use ``value`` property to get or set the value of the field. 

Getting value
-------------

When field data is ``null``, the field converts it to ``0``, if 
the field_type is "integer", "float" or "currency", or to empty string if 
field_type is "text".

For 
:doc:`lookup fields </programming/data/lookup_fields>` the value of this 
property is an integer that is the value of the id field of the corresponding 
record in the lookup item. To get lookup value of the field use the 
:doc:`lookup_value <at_lookup_value>`
property.

Setting value
-------------

When a new value is assigned, the field checks if the current value is not equal
to the new one. If so it 

* sets its ``new_value`` attribute to this value, 
* triggers the
  :doc:`on_before_field_changed </refs/client/item/on_before_field_changed>`
  event if one is defined for the field, 
* changes the field data to the ``new_value`` attribute and sets it to ``null``, 
* mark item as modified, so the 
  :doc:`is_modified </refs/client/item/m_is_modified>`
  method will return ``true``
* triggers the
  :doc:`on_field_changed </refs/client/item/on_field_changed>`
  event if one is defined for the field 
* updates data-aware controls
  
See also
========

:doc:`Fields </programming/data/fields>`

:doc:`Lookup fields </programming/data/lookup_fields>`

:doc:`lookup_value <at_lookup_value>`

:doc:`text <at_text>`

:doc:`lookup_text <at_lookup_text>`
