I have a CFC which returns a query based listing of error messages. Here is the CFC:
<cffunction name="getMessage" access="public" description="Returns either a structure containing all system messages, or an array containing one or more messages corresponding to the messageID passed in from the system messages structure"> <cfargument name="messageID" type="string" required="false" default=""> <!--- Return all messages ---> <cfif messageID eq "" or messageID eq "all"> <cfreturn session.systemMessageStruct> <cfelse> <!--- Return messages based on incoming argument ---> <cfquery name="variables.qMessages" dbtype="query"> select * from session.systemMessageStruct where message_id = '#arguments.messageID#' </cfquery> <cfreturn variables.qMessages> </cfif> </cffunction> Here is the call to the getMessages function: (Yes it is set as an object) <cfset messageStruct = application.msgMgr.getMessage(attributes.messageId)> Now I can check it this way but at times it returns an error on the initial startup: <cfif messageStruct.recordcount> ... blah blah </cfif> Here is the error returned: ----------------------------------- You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. TO clarify somethings: Yes the basic structure is created as a query (dynamic query) onApplicationStart: <cfset variables.systemMessageStruct = queryNew('message_id,message,messageType,IconSize')> <!--- Copy Dynamic Query to Session Scope ---> <cfset session.systemMessageStruct = variables.systemMessageStruct> Any idea why it would return the error or a way I can prevent it? I can not use IsStruct since it is a query rather than a true structure? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295772 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4