Thanks, Mike.  It works(sorta).

Below is my original code:

<cfloop query="qry_licenseInfo">
                <cfif len(qry_licenseInfo.softwareUsers)>
                        <cfset variables.totalSoftwareUsers =
variables.totalSoftwareUsers + val(qry_licenseInfo.softwareUsers)>
                </cfif>
                <cfif len(qry_licenseInfo.softwareUsers)>
                        <cfset variables.totalCurrentLicenses =
variables.totalSoftwareUsers + val(qry_licenseInfo.currentLicenses)>
                </cfif>
                <cfif len(qry_licenseInfo.softwareUsers)>
                        <cfset variables.totalRequiredLicenses =
variables.totalSoftwareUsers + val(qry_licenseInfo.requiredLicenses)>
                </cfif>
                <cfif len(qry_licenseInfo.softwareUsers)>
                        <cfset variables.totalRequiredUpgrades =
variables.totalSoftwareUsers + val(qry_licenseInfo.requiredUpgrades)>
                </cfif>
</cfloop>

Here's what I did with your suggestion:

<cfset variables.totalSoftwareUsers =
arraySum(listToArray(valueList(qry_licenseInfo.softwareUsers)))>
<cfset variables.totalCurrentLicenses =
arraySum(listToArray(valueList(qry_licenseInfo.currentLicenses)))>
<cfset variables.totalRequiredLicenses =
arraySum(listToArray(valueList(qry_licenseInfo.requiredLicenses)))>
<cfset variables.totalRequiredUpgrades =
arraySum(listToArray(valueList(qry_licenseInfo.requiredUpgrades)))>

However, I've run into a snag.  The query I'm working with is returning
empty strings for some of the records.  When this occurs, I am getting this
for output:
Total Software Users: 2.12453679578E-314

Is there something I can tweak?  The single cfset is much more economical
overhead wise, but I'm not sure what to change to get a "0" when nothing but
empty strings are contained in the result set for each aggregate list.

Thanks again for the help!



Matthew P. Smith 
Web Developer, Object Oriented 
Naval Education & Training Professional 
Development & Technology Center 
(NETPDTC) 
(850)452-1001 ext. 1245 
[EMAIL PROTECTED] 


>>-----Original Message-----
>>From: Mike Townend [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, November 29, 2002 12:01 PM
>>To: CF-Talk
>>Subject: RE: sum values in list
>>
>>Try
>>
>>#ArraySum(ListToArray(myList))#
>>
>>HTH
>>
>>
>>
>>-----Original Message-----
>>From: Smith, Matthew P -CONT(DYN) [mailto:[EMAIL PROTECTED]]
>>
>>Sent: Friday, November 29, 2002 17:56
>>To: CF-Talk
>>Subject: sum values in list
>>
>>
>>I have a comma delimited list of integer values.  Is there a cf function
>>that will add all the values together?
>>
>>Or do I have to loop through the list adding each value to get the sum?
>>
>>Matthew P. Smith
>>Web Developer, Object Oriented
>>Naval Education & Training Professional
>>Development & Technology Center
>>(NETPDTC)
>>(850)452-1001 ext. 1245
>>[EMAIL PROTECTED]
>>
>>
>>
>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to