Ive never used cfloop like this before i followed advice from another member of
this forum and got this error.
This is an edit function with a drop down. if the user selects Acid and then
edits it the menu reverts to the first thing in the list not the one they had
previously selected.
The error:
Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression result
as a simple value, however, the result cannot be converted to a simple value.
Simple values are strings, numbers, boolean values, and date/time values.
Queries, arrays, and COM objects are examples of complex values.
The most likely cause of the error is that you are trying to use a complex
value as a simple one. For example, you might be trying to use a query variable
in a <CFIF> tag. This was possible in ColdFusion 2.0 but creates an error in
later versions.
The Code
The drop down menu query
<cfinvoke component="0-waste.sitewisecfc.getcategory"
method="getCategory" returnvariable="qry_getCategory">
</cfinvoke>
<cfquery name="GetPollutant" datasource="#db#">
SELECT *
FROM tblPollutant
WHERE StoryID = #StoryID# AND EBID = #EBID#
</cfquery>
<select name="EBCategory">
<cfloop query="qry_getCategory">
<option value="#industry_id#" <cfif #Getpollutant.EBCategory# EQ
#qry_getCategory#>
selected</cfif>>#pollutant_type#</option>
</cfloop>
</select>
Any ideas?
cf_dev2 - 30 May 2007 22:54 GMT
You're trying to compare a simple value to a query object: #qry_getCategory#. Try adding the column name
<cfif Getpollutant.EBCategory EQ qry_getCategory.SomeColumnName >
....