- Overloading a WLanguage function
- How to overload a WLanguage function?
- Differentiating between the WLanguage function and the custom function
- Using WLanguage functions in the SQL queries for HFSQL
- How to?
Overloading a WLanguage function or using a WLanguage function in an SQL query
Available only with these kinds of connection
WLanguage proposes the "WL.
" keyword to:
Overloading a WLanguage function
How to overload a WLanguage function?
To overload a WLanguage function:
- 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.
- 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).
- 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:
- 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:
PROCEDURE Open(WindowName is string <window name>, *)
- 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>, *)
Using WLanguage functions in the SQL queries for HFSQL
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.
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
To use WLanguage functions in the queries for HFSQL:
- Create a query in the query editor.
- 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:
SELECT Task.Caption FROM Task WHERE
WL.DateDifference(Task.StartDate, Task.EndDate) > 5
- In a mathematical formula handled by a calculated item.
- The query can be:
- 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:
For example, SQL code of query:
This page is also available for…