Link to home
Start Free TrialLog in
Avatar of mjacobs2929
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_TotalResults)#" index="i">
 <cfif Arr_TotalResults[i].SOURCE IS "Gemini">
  <cfset js_numBoth=arrayLen(Arr_TotalResults)>
 </cfif>
</cfloop>

<cfoutput>
 #js_numBoth#
</cfoutput>

ASKER CERTIFIED SOLUTION
Avatar of hart
hart
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mjacobs2929
mjacobs2929

ASKER

Brilliant!
Thanks so much for the speedy response!