Ditto, what Phillip said...but here is a hack.
<cfscript>
myStruct = structnew();
myStruct.val1 = 1;
myStruct.val2 = 3;
myStruct.val3 = 2;
list = structKeyList(myStruct);
total = 0;
for(i = 1; i LTE listLen(list); i = i + 1) {
total = total + myStruct[listGetAt(list,i)];
}
</cfscript>
<cfoutput>#total#</cfoutput>
----- Original Message -----
From: "Cantrell, Adam" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, April 03, 2002 11:14 AM
Subject: arraySum() for structures?
> Does anyone know how I can get the sum of values from a structure?
>
> Example:
>
> <cfscript>
>
> myStruct = structnew();
> myStruct.val1 = "1";
> myStruct.val2 = "3";
> myStruct.val3 = "2";
>
> </cfscript>
>
> I want to quickly return the sum, 6, without having to loop over the keys
> and all that. Is it possible?
>
> Adam.
>
>
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists