mjacobs2929
asked on
Coldfusion ArrayLen() Problem
I have an array of a structure from which I am already successfully outputting the correct number of results (where Arr_TotalResults[i].SOURCE IS "Gemini", which is outputting 5 rows because only 5 elements EQ Gemini). I now need to get the array length MINUS those which do not have a structure key SOURCE IS "Gemini". I thought the code below would do this because it is already working on the output, however, it's giving me the full length of the array (which is 11) and still including those which do not match 'Gemini'. Please can someone tell me what I'm doing wrong here??
Many thanks,
Michelle
<cfloop from="1" to="#arrayLen(Arr_TotalRes ults)#" index="i">
<cfif Arr_TotalResults[i].SOURCE IS "Gemini">
<cfset js_numBoth=arrayLen(Arr_To talResults )>
</cfif>
</cfloop>
<cfoutput>
#js_numBoth#
</cfoutput>
Many thanks,
Michelle
<cfloop from="1" to="#arrayLen(Arr_TotalRes
<cfif Arr_TotalResults[i].SOURCE
<cfset js_numBoth=arrayLen(Arr_To
</cfif>
</cfloop>
<cfoutput>
#js_numBoth#
</cfoutput>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks so much for the speedy response!