Skip to content

REST_GetFieldsInTable

Julio Carneiro edited this page Jan 17, 2018 · 5 revisions

The REST_GetFieldsInTable HTTP POST Request is used to retrieve a description of all visible fields on a given Table.

The POST request payload must include the following arguments/attributes:

  • TableName: the name of a Table in the 4D Structure whose field description is to be retrieved

The Request returns a JSON object with the following attributes:

  • tableNo: an integer indicating the Number of the given Table in the database structure.
  • primaryKey: a string with the name of the Table's Primary Key field.
  • fieldCount: the total number of visible Fields in the given Table.
  • fieldList: an Array of JSON objects describing each field in the Table; each item has the following attributes:
    • fieldNo: the Field number on the Table
    • name: the Field name
    • longname: the Field name in the long dot notation, in the format "Table.Field"
    • type: the Field type, actually the corresponding javascript Field type, not 4D's (see table below)
    • length: the Field length, if the Field is an Alpha field on the Table structure
    • required: true/false indicating if Field is mandatory, that is, it cannot be empty/null
    • indexed: true/false indicating if Field is indexed in the database
    • unique: true/false indicating if Field must be unique in the database
    • readonly: true/false indicating if Field is read only, that is, it cannot be modified
    • choiceList: the name of the Choice List associated to the Field
    • relatesTo: if Field has a one-relation to another Field in the database this attribute will contain the related one field name, in the long dot notation ("Table.Field")

Only "visible" fields will be listed, that is, any field that is marked as invisible will not come up on the field list.


Here is a sample payload sent on a call to REST_GetFieldsInTable:

https://gyazo.com/a5076bcfdb421896100ad0455d6c0857

And a sample response from the request above:

https://gyazo.com/a5bda3f600daa9224722c1e391dd96d6

The 4D Field type is converted to a javascript type according to the table below:

4D Type javascript Type
Text string
Alpha string
Integer number
Longint number
Real float
Date Date
Time Time
Boolean boolean
Object json
Clone this wiki locally