Thanks. Sometimes the query will have multiple messages to be displayed with different messageIDs. Thus the reason I considered the dynamic query method :-)
I will try isQuery but I think I have found that for some reason the initial call is not creating the dynamic query itself. -----Original Message----- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Thursday, January 03, 2008 2:23 PM To: CF-Talk Subject: Re: Struct Issue On 1/3/08, Adkins, Randy <[EMAIL PROTECTED]> wrote: > > 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. This is pretty easy. It means that SOMEHOW that variable "messageStruct" contains a string and not a structure. Based on the code in the function, it's hard to imagine how this happens or why it would contain an string. One thing you might do: <cfif not isQuery(messageStruct)> --- send yourself an error message, report an error, etc --- <cfelseif messageStruct.recordcount> ... blah blah </cfif> > 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> I've had issues in the past with creating queries dynamically and not adding rows... unfortunately I can't remember exactly what those issues were. > 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? How about isQuery() =) It might also be wise to either change the variable name to NOT refer to struct, since it isn't a struct, *OR* convert the query returned - since you're expecting only one row anyway to a real structure. cflib has a nice QueryRowToStruct() function. It's more efficient to access structure elements than elements of a single-record query anyway so if you're accessing the contents of the "struct" a lot, it makes sense to convert it to a REAL struct. -- Rick Root Check out CFMBB, BlogCFM, ImageCFC, ImapCFC, CFFM, and more at www.opensourcecf.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:295777 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4