PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Operating mode
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
Returns an array containing the elements of a source array for which a procedure returns True.
Example
// Retrieve an array with all the customers
arrCustomer is array of Customer
 
// Construct the array of customers a with negative account balance
arrCustomerNegativeBalance is array of Customer
arrCustomerNegativeBalance = Filter(arrCustomer, ACustomer => ACustomer.Balance<0)
// -> keep even numbers of an array
// (prefixed syntax)
arr2 is array of int = [1, 2, 3, 4]
arr2 = arr2.Filter( X => IsEven(X))
// arr2 = [2, 4]
Syntax
<Result> = Filter(<Source array> , <Condition to check>)
<Result>: WLanguage array
Array that contains the elements of the <Array> for which the <Condition to check> returns True.
<Source array>: WLanguage array
Name of Array variable to use. This array must be a one-dimensional array.
<Condition to check>: WLanguage procedure
Name of the WLanguage procedure to be executed for each element of the <Source array>. This procedure must return True or False.
This procedure can be:
  • a global or local procedure,
  • an internal procedure.
It is also possible to directly use a lambda procedure.
Remarks

Operating mode

The <Condition to check> procedure is called for each element of the array by passing this element as a parameter.
If the procedure returns True, the element from the source array is stored in the <Result> array.
Remark: You can use the following functions in the same line of code: Map, Reduce, Apply, Min, Max, Sum, Mean, CheckAnyTrue, CheckAnyFalse, CheckAllTrue, CheckAllFalse.
Component : wd260vm.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment