In my code, I am making a http request (using cfhttp) and storing the result in a variable. The http request does return results- I know this because I am logging the time of the request and the results.
However, something is apparently going wrong sometimes with storing the results of the http request (cfhttp.filecontent) in a variable, because later, when I set another variable to the first variable, the first variable is occasionally throwing an error ("Element insurance_233 is undefined in a CFML structure referenced as part of an expression."). When I dump out the session variable, the element is, sure enough, not there. I can't figure out what causes the error to occur.
Here is the code (modified slightly, but in essence enough to illustrate what I'm talking about. The trim was added in in the hopes it would solve the error. Also, I subsequently changed "inurance" & #myNum# to the more syntactically correct "insurance#myNum#", but for this illustration I left it in its original state to show how it was the last time the error was thrown.):
<cfloop query="myQuery"> <!--- one of the query columns is myNum--->
<cflock scope="session" type="exclusive" timeout="10">
<cfset session.report.mydata["insurance_" & #myNum#] = cfhttp.filecontent>
</cflock>
<cfset request.report.mydata["insurance_" & #myNum#] = trim(session.report.mydata["insurance_" & #myNum#])>
</cfloop>