IF (variables.cfcReferenceVars = user.getUser() ) Works and all casing is kept perfectly,
you would think
variables = user.getUser() would work as well.
I am strictly trying to adhere to CamelCasing code style and it becomes a problem when
other developers see either UPPER CASE OR LOWER CASE in CFDUMP
I am not sure.. why CFMX automatically changes CASES of variables..
e.g.
var user = structNew();
user['firstName'] = "fn";
user['lastName] = "ln";
IS NOT THE SAME AS
var user = structNew();
user.firstName = "fn";
user.lastName = "ln";
There might some wierd conversion between CFMX and Java HashMaps
If its a Java HashMap... your code should be in THIS Notation (user['lastName])
Anyways, i think there might be a better way around this.
Thanks,
Joe Eugene
----- Original Message -----
From: Barney Boisvert
To: CF-Talk
Sent: Wednesday, January 28, 2004 4:31 PM
Subject: RE: Return Data to variables scope
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]

