Hi Mike,

The good news is that it worked, no more error.
The thing is that I'm passing the struct to a cffunction and then loop
and insert each one in the db.

So basically I will have to var and to deconstruct the struct values
and then use them for the insert.

Any reason for this behaviour?

@brad In the real code I was just accessing the struct for insert:
<cffunction name="save" access="public" displayname="save"
output="no"      returntype="void">
                <cfargument name="stArg" type="struct" required="yes" />
                
                <cfset var i = 0 />
                <cfset var q = "" />
                
                <cfloop collection="#arguments.stArg#" item="i">
                        <cfquery name="q" datasource="#variables.dsn#">
                                insert into tables values (
                                                        <cfqueryparam 
cfsqltype="cf_sql_varchar" null="#not len
(arguments.stArg[i].descr)#" value="#arguments.stArg[i].descr#" />,
                                                        ......          
                        </cfquery>
                </cfloop>
                <cfreturn />    
        </cffunction>

The descr set was only when I was trying to debug.

Thank you all
Victor

On Tue, Nov 3, 2009 at 10:44 PM, Mike Chabot <[email protected]> wrote:
>
> Replace that cfset line with the following to see if it throws the same error:
> <cfset variables.x = arguments.stArg[i].descr>
>
> -Mike Chabot
>
> On Tue, Nov 3, 2009 at 10:24 PM, Victor Moore <[email protected]> wrote:
>>
>> Hi,
>>
>> I'm getting a real nasty error and not sure how to fix it.
>>
>> This is the code:
>> <cfloop collection="#arguments.stArg#" item="i">
>>        <cfset descr = arguments.stArg[i].descr> <!--- gives You have
>> attempted to dereference a scalar variable of type class
>> java.lang.String as a structure with members. --->
>>        but
>>       <cfoutput>#arguments.stArg[i].descr#</cfoutput> isOK
>> </cfloop>
>>
>> The struct is created with structNew () and I can dump it and
>> everything looks fine, but when I'm trying to access it I'm getting
>> the error.
>>
>> What gives?
>> Server CF 8.01.
>>
>> Any help would be greatly appreciated!
>>
>> Thanks in advance.
>> Victor
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327983
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to