PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Overloading a WLanguage function
  • Overview
  • How to overload a WLanguage function?
  • Differentiating between the WLanguage function and the custom function
  • Using WLanguage functions in the SQL queries for HFSQL
  • Overview
  • How to?
  • Remarks
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
Overview
WLanguage proposes the "WL." keyword to:
  • Overload a WLanguage function.
  • Use a WLanguage function in an SQL query run by the HFSQL engine.
    Versions 22 and later
    Remark: The "WL." keyword also allows you to use a WLanguage constant in an SQL query containing a WLanguage function.
    New in version 22
    Remark: The "WL." keyword also allows you to use a WLanguage constant in an SQL query containing a WLanguage function.
    Remark: The "WL." keyword also allows you to use a WLanguage constant in an SQL query containing a WLanguage function.
Remark: From version 19, HFSQL is the new name of HyperFileSQL.
Overloading a WLanguage function
WEBDEV - Server code

Overview

Overloading a WLanguage function allows you to use a custom function with the same name as the WLanguage function.
For example, instead of using the standard WLanguage function Info, you can use a custom procedure named Info. The custom procedure will be run whenever Info is called.
WEBDEV - Server code

How to overload a WLanguage function?

To overload a WLanguage function:
  1. Create a new procedure in your project (local or global procedure). This procedure must have the following characteristics:
    • The same name as the WLanguage function to overload.
    • The same number of parameters as the WLanguage function to overload. These parameters must have the same type as the parameters of the WLanguage function.
  2. The custom procedure will be used instead of the WLanguage function whenever the name of the function/procedure is used in the project (or in the window if the created procedure is a local procedure).
Remarks:
  • Overloading WLanguage functions is ignored during the dynamic compilation. For example, if Trace has been overloaded, the WLanguage function (not the overloaded function) will be called in a code that is dynamically compiled.
  • If the WLanguage function has multiple syntaxes (e.g., ToastDisplay), the overloaded function will be executed regardless of the syntax called. If the WLanguage function has multiple syntaxes with parameters of different types, the new procedure will need to have multiple syntaxes if it is to match all the call possibilities.
  • Versions 19 and later
    You have the ability to overload functions that handle windows, pages or reports. Simply use the following notation to define the parameter corresponding to the desired element in the procedure that overloads the function:
    • WEBDEV - Server code For the pages, the parameter must be defined by the following notation "PageName is string <page name>". For example, to overload PageDisplay, the procedure code will be:
      PROCEDURE PageDisplay(PageName is string <page name>, *)
    • For the reports, the parameter must be defined by the following notation "ReportName is string <report name>". For example, to overload iPrintReport, the procedure code will be:
      PROCEDURE iPrintReport(ReportName is string <report name>, *)
    For more details, see Procedure parameters.
    New in version 19
    You have the ability to overload functions that handle windows, pages or reports. Simply use the following notation to define the parameter corresponding to the desired element in the procedure that overloads the function:
    • WEBDEV - Server code For the pages, the parameter must be defined by the following notation "PageName is string <page name>". For example, to overload PageDisplay, the procedure code will be:
      PROCEDURE PageDisplay(PageName is string <page name>, *)
    • For the reports, the parameter must be defined by the following notation "ReportName is string <report name>". For example, to overload iPrintReport, the procedure code will be:
      PROCEDURE iPrintReport(ReportName is string <report name>, *)
    For more details, see Procedure parameters.
    You have the ability to overload functions that handle windows, pages or reports. Simply use the following notation to define the parameter corresponding to the desired element in the procedure that overloads the function:
    • WEBDEV - Server code For the pages, the parameter must be defined by the following notation "PageName is string <page name>". For example, to overload PageDisplay, the procedure code will be:
      PROCEDURE PageDisplay(PageName is string <page name>, *)
    • For the reports, the parameter must be defined by the following notation "ReportName is string <report name>". For example, to overload iPrintReport, the procedure code will be:
      PROCEDURE iPrintReport(ReportName is string <report name>, *)
    For more details, see Procedure parameters.
WEBDEV - Server code

Differentiating between the WLanguage function and the custom function

If a WLanguage function was overloaded and if you want to use the initial function, the name of the function must be prefixed by WL. The following syntax must be used:
WL.<Function name>
For example, to override the WLanguage function Trace, you can use the following code:
PROCEDURE Trace(Information1)
Message("Start a trace")
WL.Trace(Information1)
Using WLanguage functions in the SQL queries for HFSQL

Overview

A WLanguage function can be used in an SQL query. This SQL query can be run on HFSQL files. You can for example use the WLanguage functions to create advanced selection conditions.
You can use WLanguage functions:
  • directly in the SQL code of a query,
  • in the query editor (e.g., when creating a calculation item that uses a mathematical formula),
  • with queries defined by the SQL query type.

How to?

To use WLanguage functions in the queries for HFSQL:
  1. Create a query in the query editor.
  2. To use the WLanguage functions in the query, use the following notation: WL.<Function name>
    The WLanguage functions can be used for example:
    • In the SQL code of the query. Example:
      -- Selecting the tasks exceeding 5 days
      SELECT Task.Caption FROM Task WHERE
      WL.DateDifference(Task.StartDate, Task.EndDate) > 5
    • In a mathematical formula handled by a calculated item.
  3. The query can be:

Remarks

  • Only the WLanguage functions can be used in the queries. The properties cannot be used.
  • Several WLanguage functions can be nested in a query.
  • If the WLanguage functions is used in SELECT, the returned value is a text memo.
  • This syntax can only be used with HFSQL Classic, Mobile and Client/Server.
  • The limits of the WLanguage function are identical if the function is used in a query.
  • The following functions are available in the queries:
  • To use Open, OpenChild and OpenPopup in the queries, the name of windows must be passed in character string format (between quotes).
  • Versions 22 and later
    To use a WLanguage constant in the queries containing WLanguage functions, use the following notation:
    WL.<Constant name>

    For example, SQL code of query:
    SELECT
    WL.ExtractString('A|B|C',1,'|'),
    WL.ExtractString('A|B|C',1,'|', WL.FromEnd)
    FROM
    DUAL
    New in version 22
    To use a WLanguage constant in the queries containing WLanguage functions, use the following notation:
    WL.<Constant name>

    For example, SQL code of query:
    SELECT
    WL.ExtractString('A|B|C',1,'|'),
    WL.ExtractString('A|B|C',1,'|', WL.FromEnd)
    FROM
    DUAL
    To use a WLanguage constant in the queries containing WLanguage functions, use the following notation:
    WL.<Constant name>

    For example, SQL code of query:
    SELECT
    WL.ExtractString('A|B|C',1,'|'),
    WL.ExtractString('A|B|C',1,'|', WL.FromEnd)
    FROM
    DUAL
Related Examples:
Overloading WLanguage functions Unit examples (WINDEV): Overloading WLanguage functions
[ + ] Overloading WLanguage functions.
This example overloads the Trace function and it is used to:
- Display a "normal" trace
- Display a trace and save the data in a file
- Perform a file trace (the information is saved in a file)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment