Skip to main content
Version: 20 R5

Data Source

Automatic Insertion

When this option is selected, if a user enters a value that is not found in the list associated with the object, this value is automatically added to the list stored in memory.

When the automatic insertion option is not set (default), the value entered is stored in the form object but not in the list in memory.

This property is supported by:

  • Combo box and list box column form objects associated to a choice list.
  • Combo box form objects whose associated list is filled by their array or object datasource.

For example, given a choice list containing "France, Germany, Italy" that is associated with a "Countries" combo box: if the automatic insertion property is set and a user enters "Spain", then the value "Spain" is automatically added to the list in memory:

If the choice list was created from a list defined in Design mode, the original list is not modified.

JSON Grammar

NameData TypePossible Values
automaticInsertionbooleantrue, false

Objects Supported

Combo Box - List Box Column


Choice List

Associates a choice list with an object. It can be a choice list name (a list reference) or a collection of default values.

You can also associate choice lists to objects using the OBJECT SET LIST BY NAME or OBJECT SET LIST BY REFERENCE commands.

JSON Grammar

NameData TypePossible Values
choiceListlist, collectionA list of possible values
listlist, collectionA list of possible values (hierarchical lists only)

Objects Supported

Drop-down List - Combo Box - Hierarchical List - List Box Column


Choice List (static list)

List of static values to use as labels for the tab control object.

JSON Grammar

NameData TypePossible Values
labelslist, collectionA list of values to fill the tab control

Objects Supported

Tab Control


Current item

Collection or entity selection list boxes

Specifies a variable or expression that will be assigned the collection element/entity selected by the user. You must use an object variable or an assignable expression that accepts objects. If the user does not select anything or if you used a collection of scalar values, the Null value is assigned.

This property is "read-only", it is automatically updated according to user actions in the list box. You cannot edit its value to modify the list box selection status.

JSON Grammar

NameData TypePossible Values
currentItemSourcestringObject expression

Objects Supported

List Box


Current item position

Collection or entity selection list boxes

Specifies a variable or expression that will be assigned a longint indicating the position of the collection element/entity selected by the user.

  • if no element/entity is selected, the variable or expression receives zero,
  • if a single element/entity is selected, the variable or expression receives its location,
  • if multiple elements/entities are selected, the variable or expression receives the position of element/entity that was last selected.

This property is "read-only", it is automatically updated according to user actions in the list box. You cannot edit its value to modify the list box selection status.

JSON Grammar

NameData TypePossible Values
currentItemPositionSourcestringNumber expression

Objects Supported

List Box


Data Type (expression type)

Defines the data type for the displayed expression. This property is used with:

See also Expression Type section.

JSON Grammar

NameData TypePossible Values
dataSourceTypeHintstring
  • list box columns: "boolean", "number", "picture", "text", date", "time". Array/selection list box only: "integer", "object"
  • drop-down lists: "object", "arrayText", "arrayDate", "arrayTime", "arrayNumber"
  • Objects Supported

    Drop-down Lists associated to objects or arrays - List Box column


    Data Type (list)

    Defines the type of data to save in the field or variable associated to the drop-down list. This property is used with:

    Three options are available:

    • List reference: declares that the drop-down list is hierarchical. It means that the drop-down list can display up to two hierarchical levels and its contents can be managed by the 4D language commands of the Hierarchical Lists theme.
    • Selected item value (default): the drop-down list is not hierarchical and the value of the item chosen in the list by the user is saved directly. For example, if the user chooses the value "Blue", then this value is saved in the field.
    • Selected item reference: the drop-down list is not hierarchical and the reference of the choice list item is saved in the object. This reference is the numeric value associated with each item either through the itemRef parameter of the APPEND TO LIST or SET LIST ITEM commands, or in the list editor. This option lets you optimize memory usage: storing numeric values in fields uses less space than storing strings. It also makes it easier to translate applications: you just create multiple lists in different languages but with the same item references, then load the list based on the language of the application.

    Using the Selected item reference option requires compliance with the following principles:

    • To be able to store the reference, the field or variable data source must be of the Number type (regardless of the type of value displayed in the list). The expression property is automatically set.
    • Valid and unique references must be associated with list items.
    • The drop-down list must be associated with a field or a variable.

    JSON Grammar

    NameData TypePossible Values
    saveAsstring"value", "reference"

    Setting only "dataSourceTypeHint" : "integer" with a "type": "dropdown" form object will declare a hierarchical drop-down list.

    Objects Supported

    Drop-down Lists associated to lists


    Default (list of) values

    List of values that will be used as default values for the list box column (array type only). These values are automatically available in the array variable associated with this column when the form is executed. Using the language, you can manage the object by referring to this array.

    Do not make confusion between this property and the "default value" property that allows to define a field value in new records.

    You must enter a list of values. In the Form editor, a specific dialog box allows you to enter values separated by carriage returns:

    You can also define a choice list with the list box column. However, a choice list will be used as list of selectable values for each column row, whereas the default list fill all column rows.

    JSON Grammar

    NameData TypePossible Values
    valuescollectionA collection of default values (strings), ex: "a", "b", "c", "d"

    Objects Supported

    List Box Column (array type only)


    Expression

    This description is specific to selection and collection type list box columns. See also Variable or Expression section.

    A 4D expression to be associated with a column. You can enter:

    • A simple variable (in this case, it must be explicitly declared for compilation). You can use any type of variable except BLOBs and arrays. The value of the variable will be generally calculated in the On Display Detail event.

    • A field using the standard [Table]Field syntax (selection type list box only), for example: [Employees]LastName. The following types of fields can be used:

      • String
      • Numeric
      • Date
      • Time
      • Picture
      • Boolean
        You can use fields from the Master Table or from other tables.
    • A 4D expression (simple expression, formula or 4D method). The expression must return a value. The value will be evaluated in the On Display Detail and On Data Change events. The result of the expression will be automatically displayed when you switch to Application mode. The expression will be evaluated for each record of the selection (current or named) of the Master Table (for selection type list boxes), each element of the collection (for collection type list boxes) or each entity of the selection (for entity selection list boxes). If it is empty, the column will not display any results. The following expression types are supported:

      • String
      • Numeric
      • Date
      • Picture
      • Boolean

    For collection/entity selection list boxes, Null or unsupported types are displayed as empty strings.
    When using collections or entity selections, you will usually declare the element property or entity attribute associated to a column within an expression containing This. This is a dedicated 4D command that returns a reference to the currently processed element. For example, you can use This.\<propertyPath> where \<propertyPath> is the path of a property in the collection or an entity attribute path to access the current value of each element/entity. If you use a collection of scalar values, 4D will create an object for each collection element with a single property (named "value"), filled with the element value. In this case, you will use This.value as expression.

    If a non-assignable expression is used (e.g. [Person]FirstName+" "+[Person]LastName), the column is never enterable even if the Enterable property is enabled.

    If a field, a variable, or an assignable expression (e.g. Person.lastName) is used, the column can be enterable or not depending on the Enterable property.

    JSON Grammar

    NameData TypePossible Values
    dataSourcestringA 4D variable, field name, or an arbitrary complex language expression.

    Objects Supported

    List Box Column


    Master Table

    Current selection list boxes

    Specifies the table whose current selection will be used. This table and its current selection will form the reference for the fields associated with the columns of the list box (field references or expressions containing fields). Even if some columns contain fields from other tables, the number of rows displayed will be defined by the master table.

    All database tables can be used, regardless of whether the form is related to a table (table form) or not (project form).

    JSON Grammar

    NameData TypePossible Values
    tablenumberTable number

    Objects Supported

    List Box


    Save as

    This property is available in the following conditions:

    • a choice list is associated with the object
    • for inputs and list box columns, a required list is also defined for the object (both options should use usually the same list), so that only values from the list can be entered by the user.

    This property specifies, in the context of a field or variable associated with a list of values, the type of contents to save:

    • Save as Value (default option): the value of the item chosen in the list by the user is saved directly. For example, if the user chooses the value "Blue", then this value is saved in the field.
    • Save as Reference: the reference of the choice list item is saved in the object. This reference is the numeric value associated with each item either through the itemRef parameter of the APPEND TO LIST or SET LIST ITEM commands, or in the list editor.

    This option lets you optimize memory usage: storing numeric values in fields uses less space than storing strings. It also makes it easier to translate applications: you just create multiple lists in different languages but with the same item references, then load the list based on the language of the application.

    Using this property requires compliance with the following principles:

    • To be able to store the reference, the field or variable data source must be of the Number type (regardless of the type of value displayed in the list). The expression property is automatically set.
    • Valid and unique references must be associated with list items.

    JSON Grammar

    NameData TypePossible Values
    saveAsstring"value", "reference"

    Objects Supported

    Input - List Box Column


    Selected Items

    Collection or entity selection list boxes

    Specifies a variable or expression that will be assigned the elements or entities selected by the user.

    • for a collection list box, you must use a collection variable or an assignable expression that accepts collections,
    • for an entity selection list box, an entity selection object is built. You must use an object variable or an assignable expression that accepts objects.

    This property is "read-only", it is automatically updated according to user actions in the list box. You cannot edit its value to modify the list box selection status.

    JSON Grammar

    NameData TypePossible Values
    selectedItemsSourcestringCollection expression

    Objects Supported

    List Box


    Selection Name

    Named selection list boxes

    Specifies the named selection to be used. You must enter the name of a valid named selection. It can be a process or interprocess named selection. The contents of the list box will be based on this selection. The named selection chosen must exist and be valid at the time the list box is displayed, otherwise the list box will be displayed blank.

    Named selections are ordered lists of records. They are used to keep the order and current record of a selection in memory. For more information, refer to Named Selections section in the 4D Language Reference manual.

    JSON Grammar

    NameData TypePossible Values
    namedSelectionstringNamed selection name

    Objects Supported

    List Box