Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfset where=ArrayNew(1)>
- <cfset whereStruct=StructNew()>
- <cfset a=StructInsert(whereStruct, "field", "state") >
- <cfset a=StructInsert(whereStruct, "type", "string") >
- <cfset a=StructInsert(whereStruct, "value", "#url.stateSel#") >
- <cfset a=ArrayAppend(where, whereStruct)>
- <cfdump var="#whereStruct#">
- <cfdump var="#where#">
- <cfdump var="#where[1]['type']#">
- <cfquery name="CategoryCount" datasource="PJ">
- select Category, COUNT(category) as count
- FROM UserProfile
- <cfset dontdothisagain = false />
- <cfloop array="#where#" index="i">
- <cfif dontdothisagain eq false> WHERE <cfelse> AND </cfif> #i['field']# = <cfqueryparam CFSQLTYPE="#i['type']#" value="#i['value']#" />
- <cfset dontdothisagain = true />
- </cfloop>
- group by Category
- </cfquery>
- struct
- field state
- type string
- value IA
- array
- 1
- struct
- field state
- type string
- value IA
- string
- String: stateSel=IA&city=des+moines
- ------------------------------------
- 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.
- The error occurred on line 67.
- (line 67 is the middle of the cfloop that builds the where inside the query)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement