Field and Types – cavaliba.com

`CTRL K`

Documentation
Data
Field and Types

# Field and Types

## Schemas have fields

Example:

    - classname: _schema
      keyname: laptop

      brand:
          dataformat: string

      cpu:
          dataformat: int

Here, `brand` and `cpu` are fields. They define what a laptop is.

## Field format reference

    - classname: _schema
      keyname: (...)

      FIELDNAME:
          displayname: A_NICE_FIELDNAME     // optional
          dataformat: FIELDTYPE
          dataformat_ext:  OPTIONS          // depends on dataformat value
          cardinal_min: INT                 // optional (default 0)
          cardinal_max: INT                 // optional (default 1)
          page: MYPAGE                      // optional
          order: INT                        // optional
          default: A_VALUE                  // optional

       OTHER_FIELDNAME:
       (...)

where:

- FIELDNAME is the name of the field in the database
- displayname is a user-friendly name for humans
- dataformat is the main Field TYpe for this field. See below
- dataformat_ext provides additional information to the dataformat, such as constraints or parameters.
- cardinal_min defines the minimum number of mandatory values. 0 means the field is optional. Default is 0.
- cardinal_max defines the maximum number of accepted values. 0 means no limit (multi-valued), 1 means at most one value (single-valued field). Default is 1.
- default - default value if none provided at creation time (UI, API, import)

## Field Types

The following field types are available:

- int
- float
- string
- boolean
- ipv4
- date
- datetime
- time
- user
- group
- schema
- enumerate
- external
- text
- file

Remeber that the `dataformat_ext` parameter extends and enrich field behavior. See below for a full description of each field type.

## int

Represents an integer value.

      MYFIELD:
          dataformat: int
          dataformat_ext: [gt_#|gte_#|lt_#|lte_#]
          default: 144

Optional dataformat_ext can be a combination of:

- gt_123 : greater than 123
- gte_123: greate or equal than 123
- lt_100: lesser than 100
- lte_100: lesser or equal than 100

Example

    ## SCHEMA
    - classname: _schema
      keyname: project
      (...)

      workforce_allocated:
            displayname: Workforce allocated (man.days)
            page: Ressources
            order: 520
            dataformat: int
            dataformat_ext: gte_0 lte_500
            description: "constraint: integer value in [0, 500]"

    ## INSTANCE
    - classname: project
      keyname: project01
      workforce_allocated: 123

    ## INSTANCE multi-valued
      multifield: [12,15,-567]
      multifield: '145 234 -789'

## float

## string

## boolean

## ipv4

## date

## datetime

## time

## user

## group

## schema

## enumerate

## external

## text

## file

Schema Pipeline