Andy Matthews wrote:
> Say that I have a list of allowed nmbers:
> 32,48,64,72,144,160,200,288,320,400,512,576,640,720,800
maybe this:
<cfscript>
lowerLimit=32;
findThis=100;
if (findThis > lowerLimit) {
thisList=listToArray("32,48,64,72,144,160,200,288,320,400,512,576,640,720,800");
arraySort(thisList,"numeric","desc");
found=findThis;
isFound=false;
for (i=1; i<=arrayLen(thisList); i++) {
if (thisList[i] <= findThis) {
isFound=true;
found=thisList[i];
break;
}
}
} else {
isFound=true;
found=32;
}
writeoutput("#findThis# :: #isFound# #found#");
</cfscript>
or skip the ArraySort & loop backwards thru the thisList array.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies
around the world in government. Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290035
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4