PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Supported types
  • Sum of durations
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
Calculates the sum of the array elements.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 19 and later
Windows Mobile This function is now available for the Windows Mobile applications.
New in version 19
Windows Mobile This function is now available for the Windows Mobile applications.
Windows Mobile This function is now available for the Windows Mobile applications.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 22 and later
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
New in version 22
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
WINDEVJava This function is now available for the Java applications.
Example
// Sum of elements found in an array of integers
MyArray is array of int = [1,2,3]
MySum is numeric
MySum = Sum(MyArray) // MySum = 6
Syntax

Calculating the sum of the elements found in a a one-dimensional array (numeric types) Hide the details

<Result> = Sum(<Array>)
<Result>: Numeric
Sum of the numeric elements found in the array.
<Array>: Array variable
Name of the one-dimensional array of numeric types containing the elements whose sum must be calculated.

Calculating the sum of the elements found in a one-dimensional array (structured types) Hide the details

<Result> = Sum(<Array> , <Member>)
<Result>: Numeric
Sum of the values of members.
<Array>: Array variable
Name of the one-dimensional array of structured types. The following structured types are allowed: class, dynamic class, structure, dynamic structure.
Note: In an array of dynamic classes or in an array of dynamic structures, the element is ignored if it is not allocated.
<Member>: Character string (with or without quotes)
Name of the member containing the values that must be used to calculate the sum.

Calculating the sum of the elements found in a column of a two-dimensional array Hide the details

<Result> = Sum(<Array> , <Column>)
<Result>: Numeric
Sum of the column values.
<Array>: Array variable
Name of the two-dimensional numeric array.
<Column>: Integer
Subscript of the array column containing the values that must be used to calculate the sum.
Remarks

Supported types

The following types are supported for the arrays of numeric values and for the members of arrays of structured types:
  • all integer types (on 1, 2, 4 or 8 bytes, signed or unsigned + system integer).
  • the real type (on 4 or 8 bytes), the currency type and the numeric type.
  • the Duration type.

Sum of durations

If Sum is used to calculate a sum of durations, all the parameters must have the Duration type.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230mat.dll
Windows Mobile wp230mat.dll
Java wd230java.jar
Linux wd230mat.so
Android wd230android.jar
Minimum required version
  • Version 17
This page is also available for…
Comments
Exemplo sum
tabListanumeros is array of 0 int
//Adiciona Linha Array
ArrayAddLine(tabListanumeros,10)
ArrayAddLine(tabListanumeros,5)
ArrayAddLine(tabListanumeros,1)
//Mostra resultado Array
EDT_Texto = ArrayToString(tabListanumeros)

//http://doc.windev.com/en-US/?1000019892&name=Sum
//Calculates the sum of the array elements.
//Calcula a soma dos elementos da array.

EDT_Resultado=Sum(tabListanumeros)

http://windevdesenvolvimento.blogspot.com.br/2016/12/aula-1001-windev-array-010-sum.html
https://www.youtube.com/watch?v=8ABHvBiR6D4
De matos
Dec. 20 2016