|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Checking arrays for any values
You can do listFind(arrayToList(aYourArray),1) for the bit datatypes. I'mScott Brady 09/06/10 06:38 A In CF9, Adobe have (finally) added the ArrayFind function, which simplifies that code.Peter Boughton 09/06/10 07:07 A It's not clear what you're trying to do.Peter Boughton 09/06/10 05:36 A 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. 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 ----- Excess quoted text cut - see Original Post for more ----- -- ----------------------------------------- Scott Brady http://www.scottbrady.net/ 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.) 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. 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.)
|
February 08, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||