find Index for max value of array
I can use arrayMax to get the max value for a small array, but I need to get which index the max value is located. That will determine which page the user goes to next. Here is my code:
array:
<cfset arrAverages[1]="#qryFairness.fairness#"/>
<cfset arrAverages[2]="#qryHonesty.honesty#"/>
<cfset arrAverages[3]="#qryCompassion.compassion#"/>
<cfset arrAverages[4]="#qrySelfControl.SelfControl#"/>
<cfset arrAverages[5]="#qryMoralConcern.MoralConcern#"/>
These values are gathered from querying values stored in a table.
I can get the max value in the array easily by:
<cfdump var="#arrayMax(arrAverages)#">
What I can't figure out is how to get the row in this array where that max value is located. It seems like it would be so simple, but nothing I have tried has worked.
Thanks,
Richard
