|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Checking arrays for any values
Author: Peter Boughton
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:61887#336835
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.)
Author: Scott Brady
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:61887#336833
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/
Author: Peter Boughton
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:61887#336832
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.)
Author: Richard Steele
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:61887#336830
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.
Author: Richard Steele
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:61887#336831
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.
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||