- the memory value of the a data file fields with the value of the fields in the window. The basic of the data file items linked to the fields in the window are automatically assigned with the values of the corresponding fields.
- the value of the WLanguage variables with the value of the window controls. The WLanguage variables linked to the fields of the window are automatically assigned with the values of the corresponding fields.
This operation is performed regardless of the state of the controls (grayed, inactive or invisible).
- .toSource cannot be used to write to the data file: the variables of the data file items can only be updated (i.e variables of the record loaded in memory). To modify the records, use the functions <Source>.Add, <Source>.Modify, <Source>.Write, etc.
- This function is also available for WEBDEV pages. It is equivalent to <Page>.ToSource.
- Only the binding to the items of a data file is supported. Bindings to WLanguage variables are not supported in this version.
// Clic sur le bouton "Ajouter"
IF HErrorDuplicates() = True THEN Error("Ce numéro existe déjà")
<Window>: Window name
Name of the window where the fields are present.
Summary: Called when a control gains focus.
<Source>: Optional character string
Name of the source containing the data to update. This source can be:
If this name is not specified, all the window or page controls that are bound to a data file described in the data model editor or to a WLanguage variable will be taken into account.
- The name of a data file: only the controls bound to the items of the data file are taken into account.
- The name of a WLanguage variable: only the controls bound to the WLanguage variable are taken into account.
- If the name of the variable is enclosed in quotes, the control will be bound to the specified variable.
- If the name of the variable is not enclosed in quotes, the control will be bound to the variable data (e.g., a variable containing the name of another variable).
Binding between a control and a WLanguage variable or between a control and an item of a data file
The binding between a control and a WLanguage variable or between a control and an item of a data file can be determined:
- In the editor, in the control description window ("Binding" tab).
- Programmatically, with the DataBinding property.
Updating the items: Special cases
- To automatically assign the NULL value to an item with .toSource:
- Check "NULL supported" for the item in the data model editor.
- Select the "NULL if empty" option in the Edit control bound to the item.
- The items of the data file that are not bound to a control are not updated by .toSource.
- If several window controls are linked to the same of the data file item, the linked item may not be updated correctly by .toSource. We do not recommend linking several window controls to the same a data file item.
- .toSource does not update items or variables with the values from Image controls. Use the <Source>.LinkMemo function.
- .toSource is not available on views.
- Binding with "Secure Password" items: The value of the "Password" item cannot be modified until the user changes the value in the control bound to the item.