PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Browsing Table control based on an independent query (without parameter)
  • Principle
  • Using the HCancelDeclaration/HFreeQuery functions
  • Refreshing the query content
  • Browsing Table control based on an embedded query (without parameter)
  • Principle
  • Refreshing the query content
  • Browsing Table control based on a query with parameters (independent or embedded query)
  • Principle
  • Passing parameters to the query: .
  • Special cases: Initializing a Table control or using TableDisplay without the taReExecuteQuery constant
  • Special case: Using TableDisplay with the taReExecuteQuery constant
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Browsing tables, list boxes and combo boxes linked to queries
ODBCNot available with this kind of connection
Overview
A Table, List box or Combo box control can be used to display the content of a data file or query.
A Table, List box or Combo box control can be linked to:
  • an independent query. This query already exists in the project: all you have to do is select this query among the queries of your project.
  • a query included in the control: this query will be created in the wizard for creating the control (table, list box or combo box). This query will be available for this control only and it will be saved with the window (or with the page) that is using it. In this case, the window (or the page) contains all the necessary elements.
  • a query with parameters: this (independent or embedded) query requires parameters to run and to display the result in the Table, List box or Combo box control.
Note: This help page presents the case of Table controls, but it would be the same for List box or Combo box controls.
Versions 20 and later
Android The Table control is now available for the Android applications.
iPhone/iPad The Table control is now available for the iPhone/iPad applications.
New in version 20
Android The Table control is now available for the Android applications.
iPhone/iPad The Table control is now available for the iPhone/iPad applications.
Android The Table control is now available for the Android applications.
iPhone/iPad The Table control is now available for the iPhone/iPad applications.
Browsing Table control based on an independent query (without parameter)

Principle

A browsing Table control based on an independent query (without parameter) displays the records of this query.
By default, the query is run and loaded in memory during its first use. The result of a query used in a browsing Table control remains in memory when the associated window is closed. This query will not be re-run when it is re-used.
To re-run this query, you must use:

Using the HCancelDeclaration/HFreeQuery functions

  • If HCancelDeclaration is not called, the next initialization of Table control (re-opening the window for example) will not re-run the query. The data retrieved during the last query execution will be used. If the Table control is based on a query with parameters, see "Browsing Table control based on a query with parameters (embedded or not)".
  • If HCancelDeclaration is called, the next initialization of Table control (re-opening the window for example) will re-run the query.
Versions 16 and later
Note: HFreeQuery is based on HCancelDeclaration. Their operating mode is identical.
New in version 16
Note: HFreeQuery is based on HCancelDeclaration. Their operating mode is identical.
Note: HFreeQuery is based on HCancelDeclaration. Their operating mode is identical.
Example:
// Closing code of the window
HCancelDeclaration(MyTable..BrowsedFile)

Refreshing the query content

To force the re-execution of the query, use TableDisplay (or ListDisplay for a List Box or Combo Box control) associated with the taReExecuteQuery constant.
Browsing Table control based on an embedded query (without parameter)

Principle

A browsing Table control based on an embedded query (without parameter) displays the records of this query.
By default, the query is run and loaded in memory when the Table control is displayed. The result of an embedded query used in a browsing Table control is automatically cleared from memory when closing the associated window. This query will be re-run when it is re-used.

Refreshing the query content

To force the re-execution of the query, use TableDisplay (or ListDisplay for a List Box or Combo Box control) associated with the taReExecuteQuery constant.
Browsing Table control based on a query with parameters (independent or embedded query)

Principle

When a browsing Table control is linked to a query with parameters (independent or embedded), parameters must be passed to the query before it is run.
If these parameters are not specified before the first execution of the query, the query will not be run and the Table control will remain empty.
To pass parameters to the query, you can:
  • specify the parameters one by one by using:
    • the following notation:
      <Query Name>.<Name of Parameter1> = xxx
      <Query Name>.<Name of Parameter2> = xxx
      <Query Name>.<Name of Parameter3> = xxx

      In this case, the query is automatically run when initializing the Table control.
    • the MySource keyword:
      MySource.<Name of Parameter1> = xxx
      MySource.<Name of Parameter2> = xxx
      MySource.<Name of Parameter3> = xxx
    • the indirection:
      {"<Query Name>.<Name of Parameter 1>"} = xxx
      or
      {"<Query Name>"}.<Name of Parameter 1> = xxx
  • specify the parameters at once with HExecuteQuery.
This method for passing parameters can be used in the declaration code of global variables of the window or in the initialization code of Table control for example.
To take these parameters into account, you must use TableDisplay (or ListDisplay for a List Box or Combo Box control).
To re-run the query with different parameters, specify these new parameters and use TableDisplay (or ListDisplay for a List Box or Combo Box control).

Passing parameters to the query: <Query Name>.<Name of Parameter1>

All the query parameters do not necessarily have to be specified. The query conditions that use unspecified parameters will be ignored. See Methods for passing parameters to a query for more details.
Note: If no query parameter is specified before the first query execution, the query will not be run. The Table control associated with the query will remain empty.
Caution: All the query parameters are re-initialized whenever the query is run. The values that have been used beforehand are not stored. You must redefine the query parameters so that it can be run again.

Special cases: Initializing a Table control or using TableDisplay without the taReExecuteQuery constant

  • If no query parameter was modified since the last query execution, the query will not be re-run. The Table control will display the records corresponding to the last execution of the query.
  • Once the query parameters are modified, TableDisplay (or ListDisplay for a List Box or Combo Box control) is used to re-run the query. The Table control displays all the records corresponding to the specified parameters.

Special case: Using TableDisplay with the taReExecuteQuery constant

To force the re-execution of the query, use TableDisplay (or ListDisplay for a List Box or Combo Box control) associated with the taReExecuteQuery constant.
Reminder: The structure of the query parameters being reinitialized whenever the query is run, don't forget to redefine the requested parameters before using this function.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment