ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Query editor / Creating queries
  • Overview
  • How to?
  • Control in a window or page: switching from embedded mode to independent mode
  • Report based on an embedded query: Switching from the embedded mode to the independent mode
  • Handling an item of the embedded query through programming
  • How to use the independent or embedded queries?
  • In the page editor or the window editor: Summary table
  • In the report editor: Summary table
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
Query creation mode: independent or embedded query
ODBCNot available with this kind of connection
Overview
The query editor proposes two methods for creating a query:
  • creating the query in the query editor:
    • Click in the quick access buttons.
    • The creation window appears: click "Queries" and select the type of query to create.
      This query corresponds to a project element (".WDR" file) and it can be used as data source for a report, a window control or a page control (List Box, Combo Box or Table control), through programming, in another query, ... The query is independent.
  • creating the query when creating the ListView, Table or report based on this query ("A query that I want to define now" in the control or report creation wizard). No specific file is created. The query is embedded.
An embedded query cannot be used as data source for an element (report, ...) other than the one where this query was created.
How to?

Control in a window or page: switching from embedded mode to independent mode

To extract a query from a window control or from a page control:
  1. Display the window or the page in the editor.
  2. Select the control based on an embedded query.
  3. Select "Embedded query .. Open the associated query" in the context menu of the control.
    Caution: the window or the page must have been saved at least once.
  4. The query editor is opened and the query graph is displayed. On the "Home" tab, in the "General" group, expand "Save" and select "Export .. To an independent query".
  5. Save the new query. The query now is an independent query. It can be used in all the windows, pages and reports of your project.

Report based on an embedded query: Switching from the embedded mode to the independent mode

To extract a query from a report:
  1. Display the report on embedded query (in the report editor).
  2. Select "Edit the query" in the context menu of report. The query is displayed in the query editor. Caution: the report must be saved at least once.
  3. On the "Home" tab, in the "General" group, expand "Save" and select "Export .. To an independent query".
  4. Save the new query. The query now is an independent query.

Handling an item of the embedded query through programming

To access an item from the embedded query from the code of the control or the report, use the following syntax:
MySource.MyItem

The MySource keyword is mainly used to handle the parameters of an embedded query (in reports, Combo Box, List Box and browsing Table controls).
Remark: MySource must not be used in the control initialization code or in the report opening code.
How to use the independent or embedded queries?
WINDEVWEBDEV - Server codeWindowsHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBNative Connectors (Native Accesses)

In the page editor or the window editor: Summary table

Query typeEmbedded queryIndependent query
Initialization functionQuery without parameter: Automatic initialization.

Query with parameters: The parameters must be specified:
  • with the HExecuteQuery function.
  • with <Query name>.<Parameter name> or MySource.<Parameter name>.
Query without parameter: Automatic initialization.
You can also use HExecuteQuery.

Query with parameters: The parameters must be specified:
  • with the HExecuteQuery function.
  • with <Query name>.<Parameter name>.
Function used to pass the hQueryWithoutCorrection constantTransform the embedded query into an independent queryHExecuteQuery

For more details on how to manage queries in controls, see Table, List Box and Combo Box controls bound to queries.

In the report editor: Summary table

Query typeEmbedded queryIndependent query
Initialization functionQuery without parameter: iInitReportQuery

Query with parameters: The parameters must be specified:
HExecuteQuery, iInitReportQuery
Function used to pass the hQueryWithoutCorrection constantTransform the embedded query into an independent queryHExecuteQuery
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help