PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Simple data binding
  • Complex data binding
  • Error code (syntax 2 and 3)
  • Table control based on a data file
  • Limitations and special cases
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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 is replaced by ControlAlias.
is kept for backward compatibility: this function does not support the data binding. It is recommended to use the DataBinding property.
Versions 18 and later
WINDEVLinux This function is now available for WINDEV applications in Linux.
New in version 18
WINDEVLinux This function is now available for WINDEV applications in Linux.
WINDEVLinux This function is now available for WINDEV applications in Linux.
Example
// Get the data binding of "EDT_CustomerName"
ResDataBinding = ControlAlias(EDT_CustomerName)
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.
WEBDEV - Server code Name of the control, group of controls, Tab control, Table control based on a data file, Table columns or page 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 page 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:
    "<Base file>.<Base item>[:<Binding>[:<Binding>]]"
    <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.
WEBDEV - Server code Name of the control, group of controls, Tab control, Table control based on a data file, Table columns or page 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 page will be restored.
<caRestore>: Constant
caRestore: Constant used to restore the initial data binding of a control or group of controls.
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(WIN_Window, "CUSTOMER2001=CUSTOMER")
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: HFSQL files not initialized
  • 4: File not found
  • 5: Item or file not found
  • 6: Value of keys not found in the binding
  • 7: Locked file or binding not found
  • 10: File name too long
  • 11: Item name too long
  • 12: Too many bindings described
  • 13: Index allowed on last item only
  • 14: Index too high
  • 15: Invalid index value
  • 16: ControlAlias does not support this type of control
  • 17: Description string too long
  • 18: Bindings not allowed on a table based on a data file
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.

Table control based on a data 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: wd270obj.dll
}}
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment