Weird Struct issue

Hi Everyone I have a struct that when I dump;


looks like this;

it can be seen, that dsName exists in the struct.

Yet the following code (this line is directly below the writeDump(), complains that “key [DSNAME] doesn’t exist”

dsEntity = entityNew("#qOrigFieldsXX[1].dsName#");

I have also tried;

dsEntity = entityNew("#qOrigFieldsXX[1][DSNAME]#");

And, al though I tried on trytCF - and couldn’t replicate it - Is there something obvious that I am missing here?

Don’t forget to tell us about your stack!

OS: WIndows 11
Java Version: 11
Tomcat Version:
Lucee Version:

what if you run this:
<cfset dsEntity = entityNew(dataSource="#qOrigFieldsXX[1].dsName#")>

first thing i would check if the key name “dsName” contains a whitespace with help of this function


Hi @Terry_Whitney
Unfortunately still doesn’t work - because there is no key called “dsName”.

Thanks @micstriit,

That was it - there is a leading space in the keys.
(though I still couldn’t work out how I could trim it / pad it to make it work.)

In our case the struct’s values are always in the same order - so I have gotten around it by using structValueArray() and grabbing the 6th element.

Thanks very much for your help.
It just never occurred to me to check for surrounding whitespace.