AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de colas, pilas, listas y arrays / Funciones de arrays
  • Supported types
  • Sum of durations
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Calculates the sum of the array elements.
Ejemplo
// 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
Sintaxis

Calculating the sum of the elements found in a one-dimensional array (numeric types) Ocultar los detalles

<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) Ocultar los detalles

<Result> = Sum(<Array> , <Member>)
<Result>: Numeric
Sum of the values of members.
<Array>: Array variable
Name of the one-dimensional array of structured types. Permitted structured types are: class, dynamic class, structure, dynamic structure.
Note: In an array of dynamic classes or dynamic structures, if the element is not allocated, it is ignored.
<Member>: Character string
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 Ocultar los detalles

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

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).
  • real (4 or 8-byte), currency and numeric types.
  • the Duration type.

Sum of durations

If Sum is used to calculate a sum of durations, all parameters must be of type Duration.

Sequence of functions
You can use array functions in a sequence.
The following functions can be used in a sequence: This sequence can be used as a source for a FOR ALL statement or it can end with one of the following functions: Example:
gnMean = garrUser.Filter(cbFilter).Map(cbMap).Mean()
Clasificación Lógica de negocio / UI: Código neutro
Componente: wd300vm.dll
Versión mínima requerida
  • Versión 17
Esta página también está disponible para…
Comentarios
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
20 12 2016

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local