I posted a question yesterday about using cfset inside cffunction and received 
help, thanks! 

I've moved my cfsets above my cfldap query (which corrected my initial issue) 
but problem is the returned values from the cfldap query don't appear to be 
being set. Perhaps because the cfsets occur in the lines above the cfldap 
query? 


I've tested this by doing a cfdump just under invoking the component on another 
page. The variables returned are the ldap names not the new vars I was 
attempting to rename them to. 

I've pasted a portion of yesterdays thread below to make so you have an idea 
what's happening in my function. 

Thanks!

John













---------------
you have to place your var scoped variables at the top of the function.

in this case, you'd do something like:

<cfset var givenname = "" />
<cfset var sn = "" />
<cfset var mail = "" />

(etc)

above your <cfldap> call.

On 5/14/07, John P <[EMAIL PROTECTED]> wrote:

- Hide quoted text -
- Show quoted text -
> I am attempting to use cffunction to query a database and then cfset the 
> returned variables to a new names. I get the following error when attempting 
> to access the page.

> "Local variable givenname on line 19 must be grouped at the top of the 
> function body."

> Here's my function that appears on my .cfc page:

> <cfldap action="query"
>         name="GetIDS"
>         start="ou=ple,o=blah.com"
>         filter="id=#userID#"
>                         
> attributes="givenname,sn,mail,dbaddress,dbcity,dbstate,dbzipcode,homephone"
> server="ds.blah.com" username="uid=asdf,ou=ReadOnly,o=blah.com" 
> password="password" >

>                 <cfset var givenname = "First_name">
>                 <cfset var sn = "Last_Name">
>                 <cfset var mail = "Addr">
>                 <cfset var dbaddress = "ADDRESS">
>                 <cfset var dbcity = "City">
>                 <cfset var dbstate = "State">
>                 <cfset var dbzipcode = "ZIP">
>                 <cfset var homephone = "PHONE">

>         <cfreturn GetIDS>

>         </cffunction>

> What am I doing wrong? Is it possible to use cfset inside of a cffunction?

> Thanks!

> John   




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278173
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