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)
  • Browsing Table control
  • 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
Warning
From version 17, FieldAlias is kept for backward compatibility. This function is replaced by ControlAlias.
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.
Remark: 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 control, group of controls, tab, browsing table, table column or window to use. The data bindings of all the controls in the group, tab, browsing table, table column or window will be modified.
WEBDEV - Server code Name of control, group of controls, tab, browsing table, table column or page to use. The data bindings of all the controls in the group, tab, browsing table, table column 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 control, group of controls, tab, browsing table, table column or window to use. The data bindings of all the controls in the group, tab, browsing table, table column or window will be restored.
WEBDEV - Server code Name of control, group of controls, tab, browsing table, table column or page to use. The data bindings of all the controls in the group, tab, browsing table, table column 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 code line:
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 an error code corresponding to this message:
  • 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: Type of control not valid with ControlAlias
  • 17: Description string too long
  • 18: Bindings not allowed on a browsing table
If an error occurs when ControlAlias is called on a control, the previous binding does not change. If ControlAlias was applied to a group of controls, the control on which the error occurs and the following controls are not modified.

Browsing Table control

  • On a browsing Table control, 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 browsing Table control.

Limitations and special cases

  • ControlAlias does not operate on the memory Table controls (and their columns), on the buttons and on the 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