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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Executes a procedure on each element of a source array and returns the results in a WLanguage array.
Versions 27 and later
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
New in version 27
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
Example
arrValue is array of int = [1,2,3,4,5]
arrTriple is array of int
 
// Construct an array with the values multiplied by three
arrTriple = Map(arrValue, AValue => AValue * 3)
// arrTriple contains [3, 6, 9, 12, 15]
// -> apply lowercase to all the strings in the array
// (Prefix syntax)
arr1 is array of strings = ["A", "b", "C"]
arr1 = arr1.Map( X => Lower(X))
// arr1 = ["a", "b", "c"]
Syntax
<Result> = Map(<Source array> , <Operation to perform>)
<Result>: WLanguage array
Array that contains the result of the procedure executed for each element of the <Source array>.
<Source array>: WLanguage array
Name of the Array variable to use. This array must be a one-dimensional array.
<Operation to perform>: WLanguage procedure
Name of the WLanguage procedure to be executed for each element of the <Source array>. 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 <Operation to perform> procedure is called for each element of the source array by passing this element as a parameter.
The results of all calls are stored in the <Result> array.
Remark: You can use the following functions in the same line of code: Filter, Reduce, Applies, Min, Max, Sum, Mean, CheckAnyTrue, CheckAnyFalse, CheckAllTrue, CheckAllFalse.
Related Examples:
Filter / Map / Reduce Unit examples (WINDEV): Filter / Map / Reduce
[ + ] This example shows how to use the Filter / Map / Reduce functions.
The Filter / Map / Reduce concept allows performing operations on sets of data in a remarkably concise way.
Filter is used to filter an array of elements in a customized way (with a callback procedure).
Map is used to transform an array of elements, also with a callback procedure.
Reduce is used to aggregate data in a customized way with a callback procedure.
Here, this example is used to calculate the average age of women among the users displayed in the table below.
Business / UI classification: Neutral code
Component: wd270vm.dll
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment