ColdFusion UDF Library - structSum
December 16th, 2008
«« Back to ColdFusion Library
Category:
STRUCT
Description:
Adds up all the values in a structure
Parameters:
Returns:
(Numeric)
Requires:
Sample Use:
Copy to Clipboard
Category:
STRUCT
Description:
Adds up all the values in a structure
Parameters:
- struct (Struct, required)
The structures to search through the values to add up.
Returns:
(Numeric)
Requires:
Sample Use:
Copy to Clipboard
function structSum(struct){
var keys = structKeyArray(struct);
var loop = 0;
var value = 0;
for (loop = 1; loop lte arrayLen(keys); loop = incrementValue(loop))if (isNumeric(struct[keys[loop]]))value = value+struct[keys[loop]];
return value;
};
// http://www.programmers.org/index.php/coldfusion-udf-library/?ckey=82&function=structSum



