Question

I have a struct like this:

SESSION.Auth.Access["1"]["2"]["Write"]

If I cfdump the struct #SESSION.Auth.Access# I can see the struct in full and it 100% has the data in nested arrays.

However if I use this statement:

#StructFindValue(SESSION.Auth.Access["1"], '2', 'ALL')#

I am getting an empty array. If I use:

#ArrayLen(StructFindValue(SESSION.Auth.Access["1"], '2', 'ALL'))#

Then it returns a zero for the array length.

Am I doing something obviously wrong or is there a possible string/numeric issue going on?

Was it helpful?

Solution

So your struct could also be written like this?

SESSION.Auth.Access = {
   '1' = {
       '2' = {
          'Write' = 'foobar'
       }
    }
}

'2' is a key, not a value, so you'd need to use StructFindKey instead of StructFindValue.

Indeed this returns for me an empty array:

<cfdump var="#StructFindValue(SESSION.Auth.Access['1'], '2', 'ALL')#">

But this returns me the 'Write' struct

<cfdump var="#StructFindKey(SESSION.Auth.Access['1'], '2', 'ALL')#">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top