ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Control functions
  • Simple data binding
  • Complex data binding
  • Error code (syntax 2 and 3)
  • Data-bound Table control file
  • Limitations and special cases
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
ControlAlias (Function)
In french: ChampAlias
Gets, modifies or restores the data binding to a control or group of controls.
ControlAlias does not change the contents of the control, it only changes the data binding. To update the controls with the values of the new data binding, use FileToScreen, TableDisplay, etc.
Warning
From version 17, FieldAlias is kept for backward compatibility. This function has been replaced with ControlAlias.
function is retained for compatibility: this function does not manage data binding.. It is recommended to use the DataBinding property.
Example
// Identification de la liaison fichier du champ "SAI_NomClient"
ResLiaisonFichier = ControlAlias(SAI_NomClient)
Syntax

Getting the data binding of a control Hide the details

<Result> = ControlAlias(<Control used>)
<Result>: Character string
Data binding to a specified control. The binding has the following syntax:
"<Base file>.<Base item>[:<Binding>[:<Binding>]]"
where <Binding> corresponds to <Related file>.<Key>:<Bound item>[<Index>]
<Control used>: Control name
Name of the control to be used.

Modifying the data binding of a control or group of controls Hide the details

<Result> = ControlAlias(<Element used> , <New binding>)
<Result>: Integer
  • 0 if the modification was performed,
  • an error code (value greater than 0) otherwise.
<Element used>: Control name, control group name or window name
Name of the control, group of controls, Tab control, Table control based on a data file, Table columns or window to be used. The data bindings of all the controls in the group, Tab control, Table control based on a data file, Table columns or window will be modified.
<New binding>: Character string
New data binding. If this parameter corresponds to an empty string (""), the data binding is canceled. This new binding may correspond to:
  • a complex data binding:
    "<Fichier de base>.<Rubrique de base>[:<Liaison>[:<Liaison>]]"
    <Binding> corresponds to:
    <Related file>.<Key>:<Bound item>[<Index>]
  • a simple data binding:
    "<New base file> = <Current base file>

Restoring the initial data binding of a control or group of controls Hide the details

<Result> = ControlAlias(<Element used> , <caRestore>)
<Result>: Integer
  • 0 if the modification was performed,
  • an error code (value greater than 0) otherwise.
<Element used>: Control name, control group name or window name
Name of the control, group of controls, Tab control, Table control based on a data file, Table columns or window to be used. The data bindings of all the controls in the group, Tab control, Table control based on a data file, Table columns or window will be restored.
<caRestore>: Constant
caRestaure Constant used to restore the original data binding for a field or set of fields.
Remarks

Simple data binding

A simple binding corresponds to the following syntax: "<New base file> = <Current base file>".
In this case, only the controls bound to the items of the <Current base file> will be modified and bound to the <New base file>.
For example, the line of code:
ControlAlias(FEN_Fenêtre, "CLIENT2001=CLIENT")
will rename the CUSTOMER file as CUSTOMER2001 for the controls whose base file is "CUSTOMER". The controls with a binding to another data file will not be modified.

Complex data binding

A complex binding corresponds to the following syntax:
"<Base file>.<Base item>[:<Binding>[:<Binding>]]"
where <Binding> corresponds to:
<Related file>.<Key>:<Bound item>[<Index>]
This description corresponds to:

Error code (syntax 2 and 3)

If an error occurs, ControlAlias displays a message and returns the message error code:
  • 1: Syntax error
  • 2: Insufficient memory
  • 3: Uninitialized HFSQL data files
  • 4: File not found
  • 5: Item or file not found
  • 6: Values of keys not found in the link
  • 7: File blocked or link not found
  • 10: File name too long
  • 11: Section name too long
  • 12: Too many links described
  • 13: Index allowed only on last item
  • 14: Index too large
  • 15: Incorrect index value
  • 16: Invalid field type with function ControlAlias
  • 17: Description string too long
  • 18: Prohibited links on a file table
If an error occurs when ControlAlias is called on a control, the previous binding does not change. If ControlAlias is assigned to a group of controls, the control on which the error occurs and the following controls are not modified.

Data-bound Table control file

  • On a Table control based on a data file, only the bindings to the following elements are allowed:
    • <Base file>
    • <Base file>.<Base item>
  • <Base item> must correspond to a key item.
  • The file is replaced for all the table columns.
  • <Base item> applies to the table only.
  • ControlAlias only changes the binding of the internal file to a Table control based on a data file.

Limitations and special cases

  • ControlAlias has no effect on Table controls (and columns) with in-memory data source, buttons and ActiveX controls.
  • It may happen that no browse is currently performed on the HyperFileSQL data files when an alias or a search key is modified. Once the data bindings have been changed by ControlAlias, it is recommended to call:
Component: wd300obj.dll
}}
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help