Hi Everyone I have a struct that when I dump;
writeDump(var="#qOrigFieldsXX[1]#");
looks like this;
![image](https://dev.lucee.org/uploads/default/original/2X/8/836b87bc4d5be79582200cf2a7b65e5a7c3e968c.png)
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: 5.3.9.166
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
2 Likes
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.
Gavin.