Robert Harrison wrote:
> 1. Look in the array to see if a value exists and, if so, return the key.
>   

Not the most elegant solution, but dirt simple.

<cfscript>
searchValue = "13"
key = '';
for (i=1;i lte arrayLen(myAry); i = i + 1)
{
    if (myAry[i] = searchValue)
    {
       key = i;
       break;
    }
}
</cfscript>

<cfoutput>Key: #key#</cfoutput>

> 2. Loop through the array, output the key and use the value in a query. 
>   
<cfloop from="1" to="#arrayLen(myAry)#" index="i">
    <cfquery ....>
       SELECT aField
       FROM aTable
       WHERE aKey = <cfqueryParam value="#myAry[i]#" cfSQLtype="integer">
    </cfquery>
</cfloop>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296187
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to