You definitely don't want the behaviour you propose.  That's just asking for
trouble.  A scope reference can NEVER be confused with a variable reference
as it stands, and that's a good thing.

The uppercase issue that you describe is irrelevant as CF is
case-insensitive, but if you really want lowercase, you can replace the
structAppend call with this (assuming all your struct members are valid
variable names):

<cfset u = user.getUser() />
<cfloop collection="#u#" item="I">
  <cfset "variables.#i#" = u[i] />
</cfloop>

Cheers,
barneyb

> -----Original Message-----
> From: Joe Eugene [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 28, 2004 1:20 PM
> To: CF-Talk
> Subject: Return Data to variables scope
>
> This seems a little odd. If you return data from a CFC into
> variables scope, it creates
> a second struct "variables" within CFMX VARIABLES Scope
> unless you use structAppend..
>
> <cffunction name=getUser.....
> var user = structNew();
> user['firstName'] = "fn";
> user['lastName] = "ln";
> user['age'] = "100";
> <cfReturn user/>
>
> Calling Code
> <cfscript>
> user = createObject(....)
> variables = user.getUser()
>
> The above creates VARIABLES.variables.firstName instead of  
> "VARIABLES.firstName"
>
> The only way i found around this is
>
> structAppend(variables, user.getUser()); // but then this
> changes all the variables to UPPER Case.
>
> Is there any other way around this?
>
> Thanks,
> Joe Eugene
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to