Skip navigation
sb1817
Currently Being Moderated

ArrayFindNoCase

May 21, 2012 7:49 AM

Tags: #array #cf9;

Trying to use the ArrayFindNoCase function, but it doesnt appear to work on multidimensional arrays?  i.e. only on single dimensioned array?  can anyone confirm this is the case?

 
Replies
  • Currently Being Moderated
    Aug 23, 2013 4:08 PM   in reply to sb1817

    I am seeing the same thing.  Shame that this post has over 200 views, but no one has an answer.

     

    I am guessing "no" because every example I have Googled has only one dimension.  Looks like creating a 'fake' query from scratch is the only way to search a multidimensional recordset.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 24, 2013 11:20 AM   in reply to sb1817

    I think the disconnect you are having here is that you think CFML has multi-dimensional arrays: it doesn't. All it has is arrays that can, themselves, have element values that are also arrays (and so forth).

     

    So array functions don't operate on multi-dimensional arrays because there's no such thing in CFML.

     

    The arrayNew() function is a bit misleading because it claims it creates multidimensional arrays, but it doesn't really. For all intents and purposes arrayNew(3) does the same thing as arrayNew(1): creates an empty array.

     

    If you have this array:

     

    numbers = [

              [1,2,3,4],

              ["tahi","rua","toru","wha"],

              ["one","two","three","four"]

    ];

     

    You cannot use arrayFInd() on the numbers array to find "tahi", but you could use arrayFind() on numbers[1]. This is no help if you don't know which "sub array" the thing you're finding is in.

     

    TBH, there's seldom requirement in business type code for multi-dimensional arrays, and where people do use them, they really ought to be using arrays of structs, or arrays of objects, or similar. What's your data structure here? I ask because one can use structFindValue() to find values in structs irrespective of the complexity of said struct.

     

    --

    Adam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points