I have a model, surveyTemplate
, that has all but one of it's properties populated by a query.
I am storing an additional query in the last property of the model which is called, surveyTemplateQuestions
.
If I do the following:
writeDump(var="#surveyTemplateObj#"); abort;
I get the model correctly populated with the last property containing the query data.
I can also do this:
writeDump(var="#surveyTemplateObj.getSurveyTemplateQuestions()#"); abort;
And now I get just the query stored in the last property of the model.
So, why can I not do this:
<cfoutput query="prc.surveyTemplateObj.getSurveyTemplateQuestions()">
When doing the above I get the following error:
The value of the attribute query, which is currently prc.surveyTemplateObj.getSurveyTemplateQuestions(), is invalid.
But then I can do this instead:
<cfloop from="1" to="#prc.surveyTemplateObj.getSurveyTemplateQuestions().RecordCount#" index="i">
How can it be that when I do a cfdump
of the object's last property it shows as a query, I can do a RecordCount
on the query object, but I cannot loop over the query object via cfoutput
?
This:
prc.surveyTemplateObj.getSurveyTemplateQuestions()
is a function result. If you want to loop through it, assign it to a variable first:
myVariable = prc.surveyTemplateObj.getSurveyTemplateQuestions();
<cfoutput query = "myVariable">
etc