• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ArrayFindNoCase

New Here ,
May 21, 2012 May 21, 2012

Copy link to clipboard

Copied

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?

Views

725

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 23, 2013 Aug 23, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 24, 2013 Aug 24, 2013

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation