ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / WLanguage procedures
  • 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:
Overloading a WLanguage function
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppAndroidAndroid Widget iPhone/iPadApple WatchJavaUser code (UMC)

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.
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppAndroidAndroid Widget iPhone/iPadApple WatchJavaUser code (UMC)

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.
  • Overloaded WLanguage functions are not taken into account in the processes of an internal window, if the overload is in the window that contains the Internal Window control.
  • 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.
  • 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:
    • WINDEVWINDEV Mobile For the windows, the parameter must be defined by the following notation "WindowName is string <window name>". For example, to overload Open, the procedure code will be:
      PROCÉDURE Open(WindowName is string <window name>, *)
    • 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:
      PROCÉDURE 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:
      PROCÉDURE iPrintReport(ReportName is string <report name>, *)
    For more details, see Procedure parameters.
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppAndroidAndroid Widget iPhone/iPadApple WatchJavaUser code (UMC)

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:
PROCÉDURE 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.
Android In Android, you can use WLanguage functions in SQL queries only:
  • with HFSQL Client/Serveur databases.
  • with queries created in the query editor.
WLanguage functions cannot be used in an SQL query.

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).
  • 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

Last update: 07/05/2024

Send a report | Local help