coldfusion Error : Object of type class coldfusion.runtime.Struct cannot be used as an array
Hi,
I'm getting the above error when accessing the below code and most strange part is I could only manage to get this error one out of 50 times
CFM file
------------
<cfset aDropDown = application.GuestingController.Main("getGuestingCampaignDropDown", questions.questionID) />
<select name="questionAnswerID_#totalQuestions#" id="questionAnswerID_#totalQuestions#_PopUp" class="text">
<option value="" selected="">Select...</option>
<CFLOOP ARRAy="#aDropDown#" index="answer">
<option value="#answer.dropDownID#">#answer.dropDownText#</option>
</cfloop>
</select>
<input type="hidden" name="questionAnswerText_#totalQuestions#" value="" />
CFC
------
<cffunction name="getGuestingCampaignDropDown" access="public" returntype="Array" output="false">
<cfargument name="questionID" required="true" type="numeric">
<cfscript>
var aAnswers = ArrayNew(1);
var stAnswers = StructNew();
var qrAnswers = '';
var i = 1;
</cfscript>
<cfstoredproc procedure = "getGuestingCampaignDropDown" dataSource = "#application.ds#">
<cfprocparam type = "IN" CFSQLType = "CF_SQL_INTEGER" value = "#arguments.questionID#">
<cfprocresult name = "qAnswers" >
</cfstoredproc>
<cfscript>
for(i=1; i lte qAnswers.recordcount; i++){
stAnswers = StructNew();
stAnswers.dropDownID = qAnswers.guestingQuestionDropDownID;
stAnswers.dropDownText = qAnswers.dropDownText;
stAnswers.sequence = qAnswers.sequence;
arrayAppend(aAnswers,stAnswers);
}
</cfscript>
<cfreturn aAnswers />
</cffunction>
Can anyone please suggest me ,what is wrong with the above code.
Thanks in Advance
Nik
