Skip to main content
Version: Next

OBJECT SET DATA SOURCE

OBJECT SET DATA SOURCE ( {* ;} object ; dataSource )

ParameterTypeDescription
*Operator🡒If specified, object is an object name (string)
If omitted, object is a field or variable
objectForm object🡒Object name (if * is specified) or
Field or variable (if * is omitted)
dataSourcePointer🡒Pointer to new data source for object

Description

The OBJECT SET DATA SOURCE command modifies the data source of the object(s) designated by the object and * parameters.

Passing the optional * parameter indicates that the object parameter is an object name (string). If you do not pass this parameter, it indicates that the object parameter is a field or variable. In this case, you pass a field or variable reference instead of a string (field or variable object only).

The data source is the field or variable whose value is represented by the object when the form is executed. In Design mode, the data source is defined in the Property list, usually through the Source and Source Field (fields) or Variable Name (variables) row:

Except for list boxes (see below), all data sources of the form can be modified by this command. It is up to the developer to ensure the consistency of the changes made.

In the case of list boxes, the following points must be considered:

  • Data source modifications must take the list box type into account: for example, it is not possible to use a field as the data source for a column in an array type list box.
  • For selection type list boxes, it is not possible to modify or read the data source of the list box object itself: in this case, it is an internal reference and not a data source.
  • This command is mainly used in the context of array type list boxes. For selection type list boxes, you can use the LISTBOX SET COLUMN FORMULA command instead.

If this command is applied to a data source that is not modifiable, it does nothing.

Example

Modification of the data source for an entry area:

 var $ptrField : Pointer
 $ptrField:=Field(3;2)
 OBJECT SET DATA SOURCE(*;"Input";$ptrField)

See also

LISTBOX SET COLUMN FORMULA
OBJECT Get data source