wiki:FieldElement

<field>

A field defines one property of an entity (i.e., a table column). Example usage of the <field> element:

<field name="field_name" description="this is my first field of type string"/>
<field name="field_name" type="autoid" description="this is a id field, unique autonum integer"/>
<field name="field_name" type="xref" xref_field="other_entity.id_field"
       description="this is a crossrerence to otherentity"/>
<field name="field_name" type="enum" enum_options="[option1,option2]"
       description="this is field of type enum"/>

Required attributes

  • name="name": locally unique name for this entity (within this entity).
  • type="type": define the type of data that can be stored in this field, either:
    • type="autoid": auto incremented column (useful for entity ID).
    • type="string": a single line text string of variable length, max 255 chars.
    • type="int": a natural number.
    • type="boolean": a boolean.
    • type="decimal": a decimal number.
    • type="date": a date.
    • type="datetime": a date that includes the time.
    • type="file": attaches a file to the entity.
    • type="text": a multiline textarea of max 2gb.
    • type="xref": references to a field in another entity specified by xref_field attribute (required for xref). This will be shown as variable lookup-list.
    • type="mref": many-to-many references to a field in another entity specified by xref_field attribute (required for mref). This will be shown as multiple select lookup-list. (Under the hood, a link table is generated)
    • type="enum": references to a fixed look-up list options, specificed by enum_options attribute (required for enum)

Optional attributes

  • label="Nice screen name": an user-friendly alias to show as form header (default: copied from name).
  • unique="true": values of this field must be unique within the entity (default: "false")
  • nillable="true": this field can be left blank (default: "false")
  • readonly="true": this field cannot be edited once they are saved (default: "false")
  • length="n" (string only): limits the length of a string to 1<=n<=255 (default: "255").
  • xref_field="entityname.fieldname": specifies a foreign key to the entity and field that this xref field must reference to, separated by '.' (default: required for xref)
  • xref_label="anotherfield": makes labels for the xref options based on one field of the referenced entity (default: copied from xref_field).
  • xref_cascade="true|false": this will enable cascading deletes which means that is the related element is deleted this entity will be deleted as well.
  • enum_options="[value1,value2]": the fixed list of options for this enum (required for enum).
  • description="One line description": describes this field. This will be visibible to the user in the UI when (s)he mouses over the field or visits the documentation pages.
  • default="Pre-filling": sets a default value for this field. This value is automatically filled in for this field unless the user decides otherwise.
  • hidden="true": optional settings to hide field from view. This requires the fields to be nillable="true" or auto="true" or default!=""

No Child elements