You can probably put your winner criteria into a struct:

<cfset winnerData = {}>
<cfset winnerData["doosh"] = { category = "DOOSH Collections", winner =
"Carol Yeung" }>
etc ...

Then loop over the struct keys

<cfset result = 0>
<cfloop item="code" collection="#winnerData#">
    <cfif getImageInfo.name contains code>
        <cfset result = data[code]>
        <cfbreak>
    </cfif>
</cfloop>

<cfif isStruct(result)>
    ... you've found a match ...
<cfelse>
   ... no match found ...
</cfif>


> 2009/7/29 Mark Henderson <m...@cwc.co.nz>
>
>
>> This is a pretty basic question so I hope it makes sense, as I'm curious
>> to know what other techniques are available to achieve the same result
>> as the code below (hopefully in a more efficient manner).
>>
>> <cfscript>
>>  if (getImageInfo.name CONTAINS "doosh") {
>>    category = "DOOSH Collections";
>>    winner = "Carol Yeung";
>>  }
>>  else if (getImageInfo.name CONTAINS "heartlands") {
>>    attributes.category = "Heartlands Hotel Croydon Nightlife";
>>    attributes.winner = "Charmaine Cowlishaw";
>>  }
>>  else if (getImageInfo.name CONTAINS "kiwiana") {
>>    attributes.category = "Hokonui Heritage Centre Kiwiana";
>>    attributes.winner = "Margaret Lewis";
>>  } ...
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325066
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