Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop over lists in a query to get a sum?

Status
Not open for further replies.

Jawa

Programmer
Feb 21, 2002
74
0
0
US
I am in a dilemna. I have a query I need to loop over and get the listlen for each iteration of the loop and then get the sum. I am stuck. Can anyone lend a pointer?

Here is what I got so far:

<cfloop query="images">
<cfset num = listlen(images.photo)>
</cfloop>

From here I need the value of each loop through num and then add all the values together to get the sum of the length of all the lists total.

THANK YOU!!!!!!
 
It appears your "photo" field is a comma-separated list of "X" and you are running a query returning several records, and you want to find out how many total "X"es there are in the query results, so maybe, you have:

Name | Photo
----------------------------
John | 33,87,97,12,10
Jack | 17,12,13,45

And the number you are looking for is 9? Given that that's what you are looking for, try this:

Code:
 listlen(valuelist(images.photo))#

If that's not what you are looking for, please explain.

 
I will give that a shot too! THANKS!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top