Re: Checking arrays for any values
In CF9, Adobe have (finally) added the ArrayFind function, which simplifies that code. (Also available in OpenBD v1.3 and above, and in Railo since early days.) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336835 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Checking arrays for any values
You can do listFind(arrayToList(aYourArray),1) for the bit datatypes. I'm not sure what the performance of that will be if your array is very large, though. For the string array, you can do NOT listFind(arrayToList(aYourArray,"")) I'm not sure if that logic is exactly correct, but it should get you going down the right path. Scott On Sun, Sep 5, 2010 at 6:46 PM, Richard Steele wrote: > > If any of the elements of an array have a value of 1 for bit datatypes or > don't have empty strings for string datatypes, then I need to have my > program do one thing, otherwise, if everything is either empty or false, > another thing. I could parse the array and get their values, but I wonder > if there is an easier way. > > -- - Scott Brady http://www.scottbrady.net/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336833 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Checking arrays for any values
It's not clear what you're trying to do. Can you post examples of each type of value it might contain, and whether that is considered true/false? (It's probably still simplest to step through the array and check each value though.) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336832 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Checking arrays for any values
If any of the elements of an array have a value of 1 for bit datatypes or if all string datatypes are empty, then I need to have my program do one thing, otherwise, if everything is either empty or false, another thing. I could parse the array and get their values, but I wonder if there is an easier way. Thanks in advance. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336831 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Checking arrays for any values
If any of the elements of an array have a value of 1 for bit datatypes or don't have empty strings for string datatypes, then I need to have my program do one thing, otherwise, if everything is either empty or false, another thing. I could parse the array and get their values, but I wonder if there is an easier way. Thanks in advance. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336830 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm