Re: CFC Question

2009-09-24 Thread Brian McCairn

component=filename maybe 

~|
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:326588
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

tried that. Nope.

On Thu, Sep 24, 2009 at 11:35 AM, Brian McCairn
brian.mcca...@medicapp.eu wrote:

 component=filename maybe

 

~|
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:326591
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Brian McCairn

cfcomponent tags round the cffunction? 

~|
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:326592
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Brian McCairn

what do you get if you browse to webroot/cfc/filename.cfc?wsdl 

~|
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:326593
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Question

2009-09-24 Thread Andy Matthews

So you're calling  this file from within ColdFusion directly right?

What happens if you create it using CreateObject?

cfset myCFC = CreateObject('component','cfc.filename') 
cfset user = myCFC.Read(13204721-3474-8967-4897498740174013)

Are you getting an error? 


andy

-Original Message-
From: Phillip Vector [mailto:vec...@mostdeadlygame.com] 
Sent: Thursday, September 24, 2009 1:31 PM
To: cf-talk
Subject: CFC Question


So for the meantime, I've put my cfc directory in the web root on the
development server I use.

I have the following code to call the cfc

1
cfinvoke component=cfc.filename method=Read returnvariable=User
2
cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4

I see the 1, but nothing else (which tells me cfinvoke is not working
right).

The filename is filename.cfc and is in the cfc directory (which is
directly off the web root where I'm calling this).

The read function shows the following..

cffunction name=Read returntype=Query access=remote
cfargument name=UserID type=string
cfscriptvar Data=;/cfscript
cfquery DATASOURCE=#DS# name=Data
Select *
From Users
Where UserID=#UserID#
/cfquery
cfreturn Data
/cffunction

Why isn't it working?



~|
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:326594
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Dan Farrell

Coldfusion user has permission to the file?


So you're calling  this file from within ColdFusion directly right?

What happens if you create it using CreateObject?

cfset myCFC = CreateObject('component','cfc.filename') 
cfset user = myCFC.Read(13204721-3474-8967-4897498740174013)

Are you getting an error? 


andy

So for the meantime, I've put my cfc directory in the web root on the
development server I use.

I have the following code to call the cfc

1
cfinvoke component=cfc.filename method=Read returnvariable=User
2
cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4

I see the 1, but nothing else (which tells me cfinvoke is not working
right).

The filename is filename.cfc and is in the cfc directory (which is
directly off the web root where I'm calling this).

The read function shows the following..

   cffunction name=Read returntype=Query access=remote
   cfargument name=UserID type=string
   cfscriptvar Data=;/cfscript
   cfquery DATASOURCE=#DS# name=Data
   Select *
   From Users
   Where UserID=#UserID#
   /cfquery
   cfreturn Data
   /cffunction

Why isn't it working? 

~|
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:326595
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

Yes and cfcomponent name=filename is at the top (and closing).

filename.cfc in the cfc directory

cfcomponent name=filename
cffunction name=Read returntype=Query access=remote
cfargument name=UserID type=string
cfscriptvar Data=;/cfscript
cfquery DATASOURCE=#DS# name=Data
Select *
From Users
Where UserID=#UserID#
/cfquery
cfreturn Data
/cffunction
/cfcomponent


TestUsers.cfm

1
cfinvoke component=cfc.filename method=Read returnvariable=User
2
cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4
On Thu, Sep 24, 2009 at 12:49 PM, Dan Farrell df...@guidance.com wrote:

 Coldfusion user has permission to the file?


So you're calling  this file from within ColdFusion directly right?

What happens if you create it using CreateObject?

cfset myCFC = CreateObject('component','cfc.filename')
cfset user = myCFC.Read(13204721-3474-8967-4897498740174013)

Are you getting an error?


andy

So for the meantime, I've put my cfc directory in the web root on the
development server I use.

I have the following code to call the cfc

1
cfinvoke component=cfc.filename method=Read returnvariable=User
2
cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4

I see the 1, but nothing else (which tells me cfinvoke is not working
right).

The filename is filename.cfc and is in the cfc directory (which is
directly off the web root where I'm calling this).

The read function shows the following..

       cffunction name=Read returntype=Query access=remote
               cfargument name=UserID type=string
               cfscriptvar Data=;/cfscript
               cfquery DATASOURCE=#DS# name=Data
                       Select *
                       From Users
                       Where UserID=#UserID#
               /cfquery
               cfreturn Data
       /cffunction

Why isn't it working?

 

~|
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:326597
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CFC Question

2009-09-24 Thread Andy Matthews

Errors, yes or no? If CF is seeing it, then you should be getting a
response. If it doesn’t see it, then you should get an error. 

-Original Message-
From: Phillip Vector [mailto:vec...@mostdeadlygame.com] 
Sent: Thursday, September 24, 2009 2:59 PM
To: cf-talk
Subject: Re: CFC Question


Yes and cfcomponent name=filename is at the top (and closing).

filename.cfc in the cfc directory

cfcomponent name=filename
cffunction name=Read returntype=Query access=remote
cfargument name=UserID type=string
cfscriptvar Data=;/cfscript
cfquery DATASOURCE=#DS# name=Data
Select *
From Users
Where UserID=#UserID#
/cfquery
cfreturn Data
/cffunction
/cfcomponent


TestUsers.cfm

1
cfinvoke component=cfc.filename method=Read returnvariable=User
2
cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4
On Thu, Sep 24, 2009 at 12:49 PM, Dan Farrell df...@guidance.com wrote:

 Coldfusion user has permission to the file?


So you're calling  this file from within ColdFusion directly right?

What happens if you create it using CreateObject?

cfset myCFC = CreateObject('component','cfc.filename')
cfset user = myCFC.Read(13204721-3474-8967-4897498740174013)

Are you getting an error?


andy

So for the meantime, I've put my cfc directory in the web root on the 
development server I use.

I have the following code to call the cfc

1
cfinvoke component=cfc.filename method=Read 
returnvariable=User
2
cfinvokeargument name=UserID 
value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4

I see the 1, but nothing else (which tells me cfinvoke is not working 
right).

The filename is filename.cfc and is in the cfc directory (which is 
directly off the web root where I'm calling this).

The read function shows the following..

       cffunction name=Read returntype=Query access=remote
               cfargument name=UserID type=string
               cfscriptvar Data=;/cfscript
               cfquery DATASOURCE=#DS# name=Data
                       Select *
                       From Users
                       Where UserID=#UserID#
               /cfquery
               cfreturn Data
       /cffunction

Why isn't it working?

 



~|
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:326598
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Azadi Saryev

you do not actually have 2 and 3 as text inside your cfinvoke block,
do you?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/


On 25/09/2009 02:30, Phillip Vector wrote:
 So for the meantime, I've put my cfc directory in the web root on the
 development server I use.

 I have the following code to call the cfc

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4

 I see the 1, but nothing else (which tells me cfinvoke is not working right).

 The filename is filename.cfc and is in the cfc directory (which is
 directly off the web root where I'm calling this).

 The read function shows the following..

   cffunction name=Read returntype=Query access=remote
   cfargument name=UserID type=string
   cfscriptvar Data=;/cfscript
   cfquery DATASOURCE=#DS# name=Data
   Select *
   From Users
   Where UserID=#UserID#
   /cfquery
   cfreturn Data
   /cffunction

 Why isn't it working?

 

~|
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:326599
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

yes, but I took them out and it still has the same result. The
cfinvoke is not firing I don't think.

On Thu, Sep 24, 2009 at 1:31 PM, Azadi Saryev az...@sabai-dee.com wrote:

 you do not actually have 2 and 3 as text inside your cfinvoke block,
 do you?

 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/


 On 25/09/2009 02:30, Phillip Vector wrote:
 So for the meantime, I've put my cfc directory in the web root on the
 development server I use.

 I have the following code to call the cfc

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4

 I see the 1, but nothing else (which tells me cfinvoke is not working right).

 The filename is filename.cfc and is in the cfc directory (which is
 directly off the web root where I'm calling this).

 The read function shows the following..

       cffunction name=Read returntype=Query access=remote
               cfargument name=UserID type=string
               cfscriptvar Data=;/cfscript
               cfquery DATASOURCE=#DS# name=Data
                       Select *
                       From Users
                       Where UserID=#UserID#
               /cfquery
               cfreturn Data
       /cffunction

 Why isn't it working?



 

~|
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:326600
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Azadi Saryev

firebug will tell you if it is firing or not.

and you do have cfdump var=#user# or another output of USER var
after your cfinvoke block, right?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/


On 25/09/2009 04:45, Phillip Vector wrote:
 yes, but I took them out and it still has the same result. The
 cfinvoke is not firing I don't think.

 On Thu, Sep 24, 2009 at 1:31 PM, Azadi Saryev az...@sabai-dee.com wrote:
   
 you do not actually have 2 and 3 as text inside your cfinvoke block,
 do you?

 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/


 On 25/09/2009 02:30, Phillip Vector wrote:
 
 So for the meantime, I've put my cfc directory in the web root on the
 development server I use.

 I have the following code to call the cfc

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4

 I see the 1, but nothing else (which tells me cfinvoke is not working 
 right).

 The filename is filename.cfc and is in the cfc directory (which is
 directly off the web root where I'm calling this).

 The read function shows the following..

 � � � cffunction name=Read returntype=Query access=remote
 � � � � � � � cfargument name=UserID type=string
 � � � � � � � cfscriptvar Data=;/cfscript
 � � � � � � � cfquery DATASOURCE=#DS# name=Data
 � � � � � � � � � � � Select *
 � � � � � � � � � � � From Users
 � � � � � � � � � � � Where UserID=#UserID#
 � � � � � � � /cfquery
 � � � � � � � cfreturn Data
 � � � /cffunction

 Why isn't it working?


   

 
 

~|
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:326601
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

Not yet. However, I do have a 4 which isn't showing up (which it would
if the file got that far.

On Thu, Sep 24, 2009 at 1:53 PM, Azadi Saryev az...@sabai-dee.com wrote:

 firebug will tell you if it is firing or not.

 and you do have cfdump var=#user# or another output of USER var
 after your cfinvoke block, right?

 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/


 On 25/09/2009 04:45, Phillip Vector wrote:
 yes, but I took them out and it still has the same result. The
 cfinvoke is not firing I don't think.

 On Thu, Sep 24, 2009 at 1:31 PM, Azadi Saryev az...@sabai-dee.com wrote:

 you do not actually have 2 and 3 as text inside your cfinvoke block,
 do you?

 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/


 On 25/09/2009 02:30, Phillip Vector wrote:

 So for the meantime, I've put my cfc directory in the web root on the
 development server I use.

 I have the following code to call the cfc

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID 
 value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4

 I see the 1, but nothing else (which tells me cfinvoke is not working 
 right).

 The filename is filename.cfc and is in the cfc directory (which is
 directly off the web root where I'm calling this).

 The read function shows the following..

 � � � cffunction name=Read returntype=Query access=remote
 � � � � � � � cfargument name=UserID type=string
 � � � � � � � cfscriptvar Data=;/cfscript
 � � � � � � � cfquery DATASOURCE=#DS# name=Data
 � � � � � � � � � � � Select *
 � � � � � � � � � � � From Users
 � � � � � � � � � � � Where UserID=#UserID#
 � � � � � � � /cfquery
 � � � � � � � cfreturn Data
 � � � /cffunction

 Why isn't it working?







 

~|
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:326602
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Azadi Saryev

test your page in firefox with firebug installed. look at the Net tab to
see if the request to your cfc fires and what it returns, if anything...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/


On 25/09/2009 04:55, Phillip Vector wrote:
 Not yet. However, I do have a 4 which isn't showing up (which it would
 if the file got that far.

 On Thu, Sep 24, 2009 at 1:53 PM, Azadi Saryev az...@sabai-dee.com wrote:
   
 firebug will tell you if it is firing or not.

 and you do have cfdump var=#user# or another output of USER var
 after your cfinvoke block, right?

 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/


 On 25/09/2009 04:45, Phillip Vector wrote:
 
 yes, but I took them out and it still has the same result. The
 cfinvoke is not firing I don't think.

 On Thu, Sep 24, 2009 at 1:31 PM, Azadi Saryev az...@sabai-dee.com wrote:

   
 you do not actually have 2 and 3 as text inside your cfinvoke block,
 do you?

 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/


 On 25/09/2009 02:30, Phillip Vector wrote:

 
 So for the meantime, I've put my cfc directory in the web root on the
 development server I use.

 I have the following code to call the cfc

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID 
 value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4

 I see the 1, but nothing else (which tells me cfinvoke is not working 
 right).

 The filename is filename.cfc and is in the cfc directory (which is
 directly off the web root where I'm calling this).

 The read function shows the following..

 � � � cffunction name=Read returntype=Query access=remote
 � � � � � � � cfargument name=UserID type=string
 � � � � � � � cfscriptvar Data=;/cfscript
 � � � � � � � cfquery DATASOURCE=#DS# name=Data
 � � � � � � � � � � � Select *
 � � � � � � � � � � � From Users
 � � � � � � � � � � � Where UserID=#UserID#
 � � � � � � � /cfquery
 � � � � � � � cfreturn Data
 � � � /cffunction

 Why isn't it working?



   

 
   

 
 

~|
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:326603
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

No errors showing up on the screen (Yes, I have debugging on).

You are right. So according to what I am seeing, CF is seeing it and
processing it. Except I never see the 4.

On Thu, Sep 24, 2009 at 1:27 PM, Andy Matthews li...@commadelimited.com wrote:

 Errors, yes or no? If CF is seeing it, then you should be getting a
 response. If it doesn’t see it, then you should get an error.

 -Original Message-
 From: Phillip Vector [mailto:vec...@mostdeadlygame.com]
 Sent: Thursday, September 24, 2009 2:59 PM
 To: cf-talk
 Subject: Re: CFC Question


 Yes and cfcomponent name=filename is at the top (and closing).

 filename.cfc in the cfc directory

 cfcomponent name=filename
        cffunction name=Read returntype=Query access=remote
                cfargument name=UserID type=string
                cfscriptvar Data=;/cfscript
                cfquery DATASOURCE=#DS# name=Data
                        Select *
                        From Users
                        Where UserID=#UserID#
                /cfquery
                cfreturn Data
        /cffunction
 /cfcomponent


 TestUsers.cfm

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4
 On Thu, Sep 24, 2009 at 12:49 PM, Dan Farrell df...@guidance.com wrote:

 Coldfusion user has permission to the file?


So you're calling  this file from within ColdFusion directly right?

What happens if you create it using CreateObject?

cfset myCFC = CreateObject('component','cfc.filename')
cfset user = myCFC.Read(13204721-3474-8967-4897498740174013)

Are you getting an error?


andy

So for the meantime, I've put my cfc directory in the web root on the
development server I use.

I have the following code to call the cfc

1
cfinvoke component=cfc.filename method=Read
returnvariable=User
2
cfinvokeargument name=UserID
value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4

I see the 1, but nothing else (which tells me cfinvoke is not working
right).

The filename is filename.cfc and is in the cfc directory (which is
directly off the web root where I'm calling this).

The read function shows the following..

       cffunction name=Read returntype=Query access=remote
               cfargument name=UserID type=string
               cfscriptvar Data=;/cfscript
               cfquery DATASOURCE=#DS# name=Data
                       Select *
                       From Users
                       Where UserID=#UserID#
               /cfquery
               cfreturn Data
       /cffunction

Why isn't it working?





 

~|
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:326604
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Alan Rother

Hey Philip,
Is this literally all the code on the page?

TestUsers.cfm

1
cfinvoke component=cfc.filename method=Read returnvariable=User
2
cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
3
/cfinvoke
4

Nothing else?


If so, then, it's working... You just don't have any code to display the
result.

Add this

cfdump var=#User#


And remove those numbers from between the invoke tag, just to be safe.

-- 
Alan Rother
Adobe Certified Advanced ColdFusion MX 7 Developer
Manager, Phoenix Cold Fusion User Group, AZCFUG.org


~|
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:326605
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

That is litterally all the code in the page. It isn't firing the invoke.

But I have good news. I have been working with fusebox on this (having
double cfc's inthe circuit directory and the root just to be sure) and
it wasn't working.

I moved it over to it's own folder with no fusebox and I'm getting
errors now. So at least I can track it down.

Thanks to all who helped. I didn't think Fusebox would remove the
error messages.

On Thu, Sep 24, 2009 at 2:06 PM, Alan Rother alan.rot...@gmail.com wrote:

 Hey Philip,
 Is this literally all the code on the page?

 TestUsers.cfm

 1
 cfinvoke component=cfc.filename method=Read returnvariable=User
 2
 cfinvokeargument name=UserID value=13204721-3474-8967-4897498740174013
 3
 /cfinvoke
 4

 Nothing else?


 If so, then, it's working... You just don't have any code to display the
 result.

 Add this

 cfdump var=#User#


 And remove those numbers from between the invoke tag, just to be safe.

 --
 Alan Rother
 Adobe Certified Advanced ColdFusion MX 7 Developer
 Manager, Phoenix Cold Fusion User Group, AZCFUG.org


 

~|
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:326606
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2009-09-24 Thread Alan Rother

Glad you found the issue... however in the future, disclosing a valuable
piece of information like, the fact you're running this code inside a
fusebox app would have cut this thread down to one or two emails...

=]

-- 
Alan Rother
Adobe Certified Advanced ColdFusion MX 7 Developer
Manager, Phoenix Cold Fusion User Group, AZCFUG.org


~|
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:326607
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Question

2009-09-24 Thread Phillip Vector

Yeah. I know. I'm not thinking today. Sorry about that. I didn't think
it was that much of an issue.

I think I'm going to use application.cfc and not try to put in CFC's
into the application. It's to frustrating for not enough gain IMHO.

On Thu, Sep 24, 2009 at 2:14 PM, Alan Rother alan.rot...@gmail.com wrote:

 Glad you found the issue... however in the future, disclosing a valuable
 piece of information like, the fact you're running this code inside a
 fusebox app would have cut this thread down to one or two emails...

 =]

 --
 Alan Rother
 Adobe Certified Advanced ColdFusion MX 7 Developer
 Manager, Phoenix Cold Fusion User Group, AZCFUG.org


 

~|
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:326608
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC Question

2009-09-24 Thread Andy Matthews

Putting CFCs in the App scope is perfectly acceptable. You just have to know
that's where they're stored. With our enterprise app, we store about 2 dozen
CFCs in various scopes. Server, App, Session, etc. Each stored in the scope
most appropriate for it's use. It's helped us save memory, processing, and
offers better performance. 

-Original Message-
From: Phillip Vector [mailto:vec...@mostdeadlygame.com] 
Sent: Thursday, September 24, 2009 4:19 PM
To: cf-talk
Subject: Re: CFC Question


Yeah. I know. I'm not thinking today. Sorry about that. I didn't think it
was that much of an issue.

I think I'm going to use application.cfc and not try to put in CFC's into
the application. It's to frustrating for not enough gain IMHO.

On Thu, Sep 24, 2009 at 2:14 PM, Alan Rother alan.rot...@gmail.com wrote:

 Glad you found the issue... however in the future, disclosing a 
 valuable piece of information like, the fact you're running this code 
 inside a fusebox app would have cut this thread down to one or two
emails...

 =]

 --
 Alan Rother
 Adobe Certified Advanced ColdFusion MX 7 Developer Manager, Phoenix 
 Cold Fusion User Group, AZCFUG.org


 



~|
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:326610
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-17 Thread Jason Durham
You don't *have* to use cfinvoke.  I prefer not to.

Once you have instantiated (created an instance of it in memory) the
object like you wrote below... you can 'invoke' any of the methods by
calling them via the object instance name.

!--- Instantiate agentLibrary component ---
cfset agentLibrary =
createObject(component,components.agents.agent).init(application.dsn
) /

!--- Get a list of agents, hold in query object called 'qAgents' ---
cfset qAgents = agentLibrary.getAgents() /

!--- Loop through agents and output their names ---
cfoutput query=qAgents
Agent Name = DB_FIELD_AGENT_NAME br /
/cfoutput

Soon you will find the answer to all of your questions regarding OOP or
CFCs will be it depends.  What does your agentLibrary CFC do?  If your
agentLibrary CFC interacts with a database (as you have indicated), then
what you're doing is correct.  Set a variable to hold your DSN/DB
credentials, and reference that variable when instantiating any
components that have to access the DB. 



-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 16, 2008 3:57 PM
To: CF-Talk
Subject: RE: cfc question...

Ok, let me see if I'm understanding this...

cfset agentLibrary =
createObject(component,components.agents.agent).init(
datasourcename ) /

The part above goes in the calling page before the cfinvoke
statement, right?  If so, how does this work with the cfinvoke
statement?
Is agentLibrary above becoming the variable that will hold
all the data returned by the cfc function, agent?

And I've always defined my db's using
cfset dsn='datasource'
in my application.cfm file, so if I continue doing that, then
I guess the creation of the agentLibrary variable above would be:

cfset agentLibrary = createObject('component',
'components.agents.agent').init(#dsn#) /
or something?

Or would defining the variable 'dsn' in my application.cfm become
an obsolete practice in the 'cfc era'???

Also, in your code below, I don't see the variable 'agentLibrary' being
used
after creation (instantiation?)...so how does it fit into the cfc
functionality?

Rick


 -Original Message-
 From: Mike Kear [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 1:29 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
 Ok syntax error  forgot the closing quotes.   Make that:
 
 
 cfset agentLibrary =
createObject(component,components.agents.agent) /
 
 
 And usually at the top of an object like that (if it's for the kinds
 of things i think it is) you would have an init() functionthat you
 tell the component the datasource name. That looks something like:
 
 !--- Constructor / initialisation ---
 cffunction name=init access=Public returntype=agent
 output=false hint=Initialises the component
 cfargument name=datasourcename required=true type=string /
   cfset variables.dsn = arguments.datasourcename /
   cfreturn this /
 /cffunction
 
 
 It seems a bit of extra typing to have that at the top of your cfc,
 but for reasons of encapsulation (sorry for using the jargon!)  its
 best to have the cfc so that if it needs to know something you'll tell
 it, rather than have it rely on finding what it needs in application
 or session scope or something.So if you have that init() function
 in your component, you'd instantiate it by chaining the .init() method
 when you invoke it.  ( You can chain methods one behind the other )
 
 cfset agentLibrary =
 createObject(component,components.agents.agent).init(
 datasourcename ) /
 
 Throughout your cfc, wherever any function needs to run a query on the
 datasource, it will do it like so:
 
 cfquery name=qThisQuery datasource=#variables.dsn#
SELECT AgentID from Agents
   WHERE  GRPOffCE = cfqueryparam value=#officeid#
 cfsqltype=cf_sql_varchar/
 /cfquery
 
 
 That way you can easily reuse the component without having to need the
 datasource to exist in application scope or anywhere else for that
 matter.  The cfc needs to know the datasourcename so you tell it that
 when you instantiate the cfc.
 
 
 Cheers
 Mike Kear
 Windsor, NSW, Australia
 Adobe Certified Advanced ColdFusion Developer
 AFP Webworks
 http://afpwebworks.com
 ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month
 
 
 
 On Mon, Jun 16, 2008 at 3:15 PM, Mike Kear [EMAIL PROTECTED]
wrote:
  I think you're nearly there, Rick.Just make sure you are
following
  the rules about how to set out paths for components:
 
  if your component is in
  e:\inetpub\webroot\c21ar\components\agents\agent.cfc   and the web
  root is at e:\inetpub\webroot\c21ar,  then you would invoke the
  component with the following: (Instantiate is another term that
  confused me at first - how is 'instantiate' different from'invoke'?
  answer:  it's the same thing)
 
  cfset agentLibrary =
createObject(component,components.agents.agent) /
 
 
 
 



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date

RE: cfc question...

2008-06-17 Thread Rick Faircloth
Thanks, Jason!  I'll work on this approach.
Seems much simpler to work with once the function
is instantiated in memory.

Here's a question:  Would I include argument variables
in a call like this?

cfset qAgents = agentLibrary.getAgents() /

I assume the parenthesis are empty because no arguments
are involved?

However, if I wanted to get a particular agent's info:

cfset qAgent = agentLibrary.get_agent_info( url.agentid ) /
if using a url, or
cfset qAgent = agentLibrary.get_agent_info( form.agentid ) /
if using a form variable to id the agent.
Correct?

Rick

 -Original Message-
 From: Jason Durham [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 17, 2008 11:09 AM
 To: CF-Talk
 Subject: RE: cfc question...
 
 You don't *have* to use cfinvoke.  I prefer not to.
 
 Once you have instantiated (created an instance of it in memory) the
 object like you wrote below... you can 'invoke' any of the methods by
 calling them via the object instance name.
 
 !--- Instantiate agentLibrary component ---
 cfset agentLibrary =
 createObject(component,components.agents.agent).init(application.dsn
 ) /
 
 !--- Get a list of agents, hold in query object called 'qAgents' ---
 cfset qAgents = agentLibrary.getAgents() /
 
 !--- Loop through agents and output their names ---
 cfoutput query=qAgents
   Agent Name = DB_FIELD_AGENT_NAME br /
 /cfoutput
 
 Soon you will find the answer to all of your questions regarding OOP or
 CFCs will be it depends.  What does your agentLibrary CFC do?  If your
 agentLibrary CFC interacts with a database (as you have indicated), then
 what you're doing is correct.  Set a variable to hold your DSN/DB
 credentials, and reference that variable when instantiating any
 components that have to access the DB.
 
 
 
 -Original Message-
 From: Rick Faircloth [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 3:57 PM
 To: CF-Talk
 Subject: RE: cfc question...
 
 Ok, let me see if I'm understanding this...
 
 cfset agentLibrary =
 createObject(component,components.agents.agent).init(
 datasourcename ) /
 
 The part above goes in the calling page before the cfinvoke
 statement, right?  If so, how does this work with the cfinvoke
 statement?
 Is agentLibrary above becoming the variable that will hold
 all the data returned by the cfc function, agent?
 
 And I've always defined my db's using
 cfset dsn='datasource'
 in my application.cfm file, so if I continue doing that, then
 I guess the creation of the agentLibrary variable above would be:
 
 cfset agentLibrary = createObject('component',
 'components.agents.agent').init(#dsn#) /
 or something?
 
 Or would defining the variable 'dsn' in my application.cfm become
 an obsolete practice in the 'cfc era'???
 
 Also, in your code below, I don't see the variable 'agentLibrary' being
 used
 after creation (instantiation?)...so how does it fit into the cfc
 functionality?
 
 Rick
 
 
  -Original Message-
  From: Mike Kear [mailto:[EMAIL PROTECTED]
  Sent: Monday, June 16, 2008 1:29 AM
  To: CF-Talk
  Subject: Re: cfc question...
 
  Ok syntax error  forgot the closing quotes.   Make that:
 
 
  cfset agentLibrary =
 createObject(component,components.agents.agent) /
 
 
  And usually at the top of an object like that (if it's for the kinds
  of things i think it is) you would have an init() functionthat you
  tell the component the datasource name. That looks something like:
 
  !--- Constructor / initialisation ---
  cffunction name=init access=Public returntype=agent
  output=false hint=Initialises the component
  cfargument name=datasourcename required=true type=string /
  cfset variables.dsn = arguments.datasourcename /
  cfreturn this /
  /cffunction
 
 
  It seems a bit of extra typing to have that at the top of your cfc,
  but for reasons of encapsulation (sorry for using the jargon!)  its
  best to have the cfc so that if it needs to know something you'll tell
  it, rather than have it rely on finding what it needs in application
  or session scope or something.So if you have that init() function
  in your component, you'd instantiate it by chaining the .init() method
  when you invoke it.  ( You can chain methods one behind the other )
 
  cfset agentLibrary =
  createObject(component,components.agents.agent).init(
  datasourcename ) /
 
  Throughout your cfc, wherever any function needs to run a query on the
  datasource, it will do it like so:
 
  cfquery name=qThisQuery datasource=#variables.dsn#
 SELECT AgentID from Agents
WHERE  GRPOffCE = cfqueryparam value=#officeid#
  cfsqltype=cf_sql_varchar/
  /cfquery
 
 
  That way you can easily reuse the component without having to need the
  datasource to exist in application scope or anywhere else for that
  matter.  The cfc needs to know the datasourcename so you tell it that
  when you instantiate the cfc.
 
 
  Cheers
  Mike Kear
  Windsor, NSW, Australia
  Adobe Certified Advanced ColdFusion Developer
  AFP Webworks
  http://afpwebworks.com

RE: cfc question...

2008-06-17 Thread Jason Durham
Yessir.  You can supply any arguments you need within those parenthesis.
:)

-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 17, 2008 1:39 PM
To: CF-Talk
Subject: RE: cfc question...

Thanks, Jason!  I'll work on this approach.
Seems much simpler to work with once the function
is instantiated in memory.

Here's a question:  Would I include argument variables
in a call like this?

cfset qAgents = agentLibrary.getAgents() /

I assume the parenthesis are empty because no arguments
are involved?

However, if I wanted to get a particular agent's info:

cfset qAgent = agentLibrary.get_agent_info( url.agentid ) /
if using a url, or
cfset qAgent = agentLibrary.get_agent_info( form.agentid ) /
if using a form variable to id the agent.
Correct?

Rick

 -Original Message-
 From: Jason Durham [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 17, 2008 11:09 AM
 To: CF-Talk
 Subject: RE: cfc question...
 
 You don't *have* to use cfinvoke.  I prefer not to.
 
 Once you have instantiated (created an instance of it in memory) the
 object like you wrote below... you can 'invoke' any of the methods by
 calling them via the object instance name.
 
 !--- Instantiate agentLibrary component ---
 cfset agentLibrary =

createObject(component,components.agents.agent).init(application.dsn
 ) /
 
 !--- Get a list of agents, hold in query object called 'qAgents' ---
 cfset qAgents = agentLibrary.getAgents() /
 
 !--- Loop through agents and output their names ---
 cfoutput query=qAgents
   Agent Name = DB_FIELD_AGENT_NAME br /
 /cfoutput
 
 Soon you will find the answer to all of your questions regarding OOP
or
 CFCs will be it depends.  What does your agentLibrary CFC do?  If
your
 agentLibrary CFC interacts with a database (as you have indicated),
then
 what you're doing is correct.  Set a variable to hold your DSN/DB
 credentials, and reference that variable when instantiating any
 components that have to access the DB.
 
 
 
 -Original Message-
 From: Rick Faircloth [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 3:57 PM
 To: CF-Talk
 Subject: RE: cfc question...
 
 Ok, let me see if I'm understanding this...
 
 cfset agentLibrary =
 createObject(component,components.agents.agent).init(
 datasourcename ) /
 
 The part above goes in the calling page before the cfinvoke
 statement, right?  If so, how does this work with the cfinvoke
 statement?
 Is agentLibrary above becoming the variable that will hold
 all the data returned by the cfc function, agent?
 
 And I've always defined my db's using
 cfset dsn='datasource'
 in my application.cfm file, so if I continue doing that, then
 I guess the creation of the agentLibrary variable above would be:
 
 cfset agentLibrary = createObject('component',
 'components.agents.agent').init(#dsn#) /
 or something?
 
 Or would defining the variable 'dsn' in my application.cfm become
 an obsolete practice in the 'cfc era'???
 
 Also, in your code below, I don't see the variable 'agentLibrary'
being
 used
 after creation (instantiation?)...so how does it fit into the cfc
 functionality?
 
 Rick
 
 
  -Original Message-
  From: Mike Kear [mailto:[EMAIL PROTECTED]
  Sent: Monday, June 16, 2008 1:29 AM
  To: CF-Talk
  Subject: Re: cfc question...
 
  Ok syntax error  forgot the closing quotes.   Make that:
 
 
  cfset agentLibrary =
 createObject(component,components.agents.agent) /
 
 
  And usually at the top of an object like that (if it's for the kinds
  of things i think it is) you would have an init() functionthat
you
  tell the component the datasource name. That looks something
like:
 
  !--- Constructor / initialisation ---
  cffunction name=init access=Public returntype=agent
  output=false hint=Initialises the component
  cfargument name=datasourcename required=true type=string /
  cfset variables.dsn = arguments.datasourcename /
  cfreturn this /
  /cffunction
 
 
  It seems a bit of extra typing to have that at the top of your cfc,
  but for reasons of encapsulation (sorry for using the jargon!)  its
  best to have the cfc so that if it needs to know something you'll
tell
  it, rather than have it rely on finding what it needs in application
  or session scope or something.So if you have that init()
function
  in your component, you'd instantiate it by chaining the .init()
method
  when you invoke it.  ( You can chain methods one behind the other )
 
  cfset agentLibrary =
  createObject(component,components.agents.agent).init(
  datasourcename ) /
 
  Throughout your cfc, wherever any function needs to run a query on
the
  datasource, it will do it like so:
 
  cfquery name=qThisQuery datasource=#variables.dsn#
 SELECT AgentID from Agents
WHERE  GRPOffCE = cfqueryparam value=#officeid#
  cfsqltype=cf_sql_varchar/
  /cfquery
 
 
  That way you can easily reuse the component without having to need
the
  datasource to exist in application scope or anywhere else for that
  matter

Re: cfc question...

2008-06-17 Thread Mike Kear
[A]   One of the good things about cfcs, and its also quite confusing
to the beginner, is that there are several ways to code most of the
things you want to do.

For example, to pass in variables to a method,  you can do it this way:

cfset qAgent = agentLibrary.get_agent_info( url.agentid ) /
Or
cfset qAgent = agentLibrary.get_agent_info( agentID=#url.agentid# ) /

(In the second case you have to make sure that the name of the
variable being passed in is exactty the same as the argument name at
the top of your method)

The first way of doing it, is less typing, but it requires that you
pass in the arguments in the exact order you have them listed in the
function of your cfc.

If you call the method like this:
cfset qAgent = agentLibrary.get_agent_info( ) /

then you have to make sure your method in the cfc is written so that
it doesnt fall over if there is no argument passed in.   Normally
you'd give the argument a default value like so:

cfargument name=agentID type=string default=333 /

So if you try to run the method without giving it an agentID, it'll
run using '333' as the value of agentID.

[B] passing in the DSN: if you put your dsn into the application
scope, as in cfset application.dsn='datasource'  then your cfc will
work, by simply calling up a query as follows:

cfquery name=qAgentQuery  datasource=#application.dsn#
SELECT whatever, whatever2, whatever3, FROM tablename
/cfquery

That will work.  But it's considered bad practice, because it is
requiring your cfc to know about the application scope.  If you move
your site around or rebuild some of it ,   you might not have the
datasouce in the application scope any more.(yes i know, I konw -
these are things that hardly ever change, but trust me, this is
definitely good advice)

Instead, you should make sure that your CFC doesnt need to know about
anything in the whole world, apart from what you tell it.  This might
seem a bit esoteric when you're talking about just a datasource name,
but i have build cfcs with 60 or 70 variables they depend on.   Making
sure those puppies are all corralled and in a nice neat row when the
cfc is called is a bugger of a job if they're called from application
scope or request scope.  I found by using that method if i changed
anything in the request scope lots of things broke all around the
place.Instead, i now use a configuration cfc and pass that into
all the cfcs that need any configuration info (one day we'll talk
about how easy it is to let ColdSpring take care of all that for you!)
 and if i change any of the configuration structure, all i have to
make sure is the configuration cfc works correctly and everything else
will work.

So in short while it's not so vital now,  it will become vital one
day.  So just get into the habit of never requiring a cfc to know
anything about its environment.   You'll tell it what it needs to know
when it's instantiated.

So therefore,  if you have your datasource name stored in an
application. variable called application.dsn,  you'd instantiate the
cfc at the top of any page that uses it like this:

cfset agentLibrary = createObject('component',
'components.agents.agent').init(application.dsn) /

[C]  multiple uses of your CFCs.

You are having multiple subdomains arent you?  One for each of your
sales agents. This screams out to me that you're going to have a lot
of similar sites.   That means you're going to be having the same code
in multiple places.  It would be good to see if you cant have the cfcs
in a central place, and available to all the subdomains.That way
you're re-using the code.  That's a good thing becuase there's less
maintenance for you in the future, easier mainetnance,  more
reliability because you dont have dozens of copies of the same
queries, functions etc all over the place.If you can manage to put
your cfcs in a common folder, and available to all the subdomains
you'll make life a LOT easier for yourself in the long run.
Remember that getAgentName() is going to be the same for one agent as
another.   also getAgentCommission() or getAgentSalesAwardBonus()
methods are going to work the same for everyone.  If you have 30
agents to build sites for, you dont want to have 30 copies of those
cfcs scattered about.   What if you make a change to something and
amend 29 of the cfcs and forget one?   If they all share the same cfc,
then change it once and it's changed on all your subdomains.

So here's a site layout i suggest you try:

e:\inetpub\webroot\c21ar\components  (-- stores al your components,
organised into subfolders if necessary.)
e:\inetpub\webroot\c21ar\components\agents
e:\inetpub\webroot\c21ar\components\admin
e:\inetpub\webroot\c21ar\components\listings
e:\inetpub\webroot\c21ar\components\utilities


e:\inetpub\webroot\c21ar\subdomain1
e:\inetpub\webroot\c21ar\subdomain2
e:\inetpub\webroot\c21ar\subdomain3
e:\inetpub\webroot\c21ar\subdomain4


WIthout playing around with it, I'm not sure exactly how this would
impact your 

RE: cfc question...

2008-06-16 Thread Rick Faircloth
There's one previous post on this thread that you sent, Azadi,
and it only had the comment:

 there's nothing lame about it.

I'll check out your method below.

Thanks,

Rick

 -Original Message-
 From: Azadi Saryev [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 1:04 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
 you can always use:
 
 cfinvoke component=dot.delimited.path.to.cfc.from.webroot
 method=your_cfc_method_name_here ...
 
 same dor notation goes for createobject() function and cfobject tag
 
 did my first comment not come through on the list yet? i do have it in
 my email inbox...
 
 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307542
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question...

2008-06-16 Thread Mike Kear
I havent seen that article, but I would suggest you put your cfcs in
their own area, since you want to re-use them as easily as possible.
(Thats one of the big benefits of CFCs).

so I'd put them in
e:\inetpub\webroot\c21ar\components\sales
e:\inetpub\webroot\c21ar\components\agents
e:\inetpub\webroot\c21ar\components\properties

or whatever seems logical.That way you have all your cfcs in
logical areas of the site,  and its' easy to find them when your site
starts to grow.(And if your client is the client i think it is,
it's going to grow!! - i have the same client elsewhere in the world)

At the top of your page, you make sure the component exists on that
page with something like this:

cfif not (isdefined(agent) )
  cfset agent = createObject(component,
components.agents.agent).init(application.dsn) /
/cfif

Then further down the page, any time you want to use a function that
is inside the agent.cfc all you have to do is call it, and give it the
variables it needs to know.   (Or more properly, all you have to do is
invoke that method, and give it the arguments it needs to know).

Such as:

cfset myquery = agent.get_agent_info( url.agentid ) /

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month




On Mon, Jun 16, 2008 at 2:56 PM, Rick Faircloth
[EMAIL PROTECTED] wrote:
 I looked over the info and I'm sure I'll end up doing that,
 but I still have to execute the code at some point, which leads
 me back to the question of how to set up paths for the cfc's.

 Let's say I've got a root folder of
 e:\inetpub\webroot\c21ar
 and a component folder path of
 e:\inetpub\webroot\c21ar\components

 How do I set the path when using the cfinvoke function?
 All the examples I've used have the cfc in the same folder as
 the calling document, so it hasn't been an issue.

 Now that it is, I can't figure out how to satisfy the cfinvoke
 function concerning the path to a cfc other that in the same folder
 as the calling document.

 I tried the source attribute in the cfinvoke function, but that
 just returned an error any way I coded it.

 CF Admin Mappings?  IIS Mappings?  Virtual Directories?
 I know this is probably something simple, but I'm just not getting it.

 Hints, anyone?

 Thanks,

 Rick


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307543
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question...

2008-06-16 Thread Mike Kear
I think you're nearly there, Rick.Just make sure you are following
the rules about how to set out paths for components:

if your component is in
e:\inetpub\webroot\c21ar\components\agents\agent.cfc   and the web
root is at e:\inetpub\webroot\c21ar,  then you would invoke the
component with the following: (Instantiate is another term that
confused me at first - how is 'instantiate' different from'invoke'?
answer:  it's the same thing)

cfset agentLibrary = createObject(component,components.agents.agent) /

Note the following:

[A] the component does not have .cfc as part of its name in the
createobject function.
[B] the path to the component is either a relative path from the page
calling it, or from the web root.Best to use the path from the web
root that way if you ever move the pages calling the components
around, they'll still work.
[C]  the path is expressed in dot notation, not using slashes.

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month



On Mon, Jun 16, 2008 at 3:04 PM, Rick Faircloth
[EMAIL PROTECTED] wrote:
 Yes, that's a good explanation of the encapsulation perspective
 and code.

 See the message I just posted for even more basic info on trying
 to help a cfinvoke function locate a cfc.  Unless I put it in the
 same folder as the calling page, I get an error saying it can't be
 found no matter how I try to set up a path using the source attribute, etc.

 ???

 Rick



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307544
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question...

2008-06-16 Thread Mike Kear
Ok syntax error  forgot the closing quotes.   Make that:


cfset agentLibrary = createObject(component,components.agents.agent) /


And usually at the top of an object like that (if it's for the kinds
of things i think it is) you would have an init() functionthat you
tell the component the datasource name. That looks something like:

!--- Constructor / initialisation ---
cffunction name=init access=Public returntype=agent
output=false hint=Initialises the component
cfargument name=datasourcename required=true type=string /
cfset variables.dsn = arguments.datasourcename /
cfreturn this /
/cffunction


It seems a bit of extra typing to have that at the top of your cfc,
but for reasons of encapsulation (sorry for using the jargon!)  its
best to have the cfc so that if it needs to know something you'll tell
it, rather than have it rely on finding what it needs in application
or session scope or something.So if you have that init() function
in your component, you'd instantiate it by chaining the .init() method
when you invoke it.  ( You can chain methods one behind the other )

cfset agentLibrary =
createObject(component,components.agents.agent).init(
datasourcename ) /

Throughout your cfc, wherever any function needs to run a query on the
datasource, it will do it like so:

cfquery name=qThisQuery datasource=#variables.dsn#
   SELECT AgentID from Agents
  WHERE  GRPOffCE = cfqueryparam value=#officeid#
cfsqltype=cf_sql_varchar/
/cfquery


That way you can easily reuse the component without having to need the
datasource to exist in application scope or anywhere else for that
matter.  The cfc needs to know the datasourcename so you tell it that
when you instantiate the cfc.


Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month



On Mon, Jun 16, 2008 at 3:15 PM, Mike Kear [EMAIL PROTECTED] wrote:
 I think you're nearly there, Rick.Just make sure you are following
 the rules about how to set out paths for components:

 if your component is in
 e:\inetpub\webroot\c21ar\components\agents\agent.cfc   and the web
 root is at e:\inetpub\webroot\c21ar,  then you would invoke the
 component with the following: (Instantiate is another term that
 confused me at first - how is 'instantiate' different from'invoke'?
 answer:  it's the same thing)

 cfset agentLibrary = createObject(component,components.agents.agent) /



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307546
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-16 Thread Rick Faircloth
Alright... I finally got a path to work.

I put a components directory in the main subdomain folder
with a a cfc called agents.cfc

I used this path to access it:

cfinvoke component = components.agents

Whew... that was driving me nuts!

I originally wanted to use the component folder in the root
of the main app, instead of creating an additional components folder
in the agents folder (which is the root folder for all the subdomains),
but I couldn't get that to work... probably because the main app
component folder is out of the path of the subdomains.

Don't know if that correct or makes any sense, but whatever... I've got
a path working!

It's 1:23am on the east coast here in the U.S. and I'm sleepy and going to bed!
(But I'll sleep soundly now!)

Thanks, everyone!

Rick

 -Original Message-
 From: Azadi Saryev [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 1:04 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
 you can always use:
 
 cfinvoke component=dot.delimited.path.to.cfc.from.webroot
 method=your_cfc_method_name_here ...
 
 same dor notation goes for createobject() function and cfobject tag
 
 did my first comment not come through on the list yet? i do have it in
 my email inbox...
 
 Azadi Saryev
 Sabai-dee.com
 http://www.sabai-dee.com/
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307545
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-16 Thread William Seiter
cfinvoke component=components.[nameofcfcfile]
method=[functionnamebeingcalled]

William

--
William Seiter
ColdFusion Web Developer / Consultant
http://william.seiter.com
 
Free Website Trade Publication  Website Magazine
http://www.websitemagazine.com/referrals/?id=51344f=text2
Don't forget to answer the survey questions, it's a 10 second task ,
a very small request  for access to this  incredible resource.
 
Have you ever read a book that changed your life?
Go to: http://www.winninginthemargins.com
Use PassKey: GoldenGrove
You'll be glad you did.
 
 
::-Original Message-
::From: Rick Faircloth [mailto:[EMAIL PROTECTED]
::Sent: Sunday, June 15, 2008 9:57 PM
::To: CF-Talk
::Subject: RE: cfc question...
::
::
::I looked over the info and I'm sure I'll end up doing that,
::but I still have to execute the code at some point, which leads
::me back to the question of how to set up paths for the cfc's.
::
::Let's say I've got a root folder of
::e:\inetpub\webroot\c21ar
::and a component folder path of
::e:\inetpub\webroot\c21ar\components
::
::How do I set the path when using the cfinvoke function?
::All the examples I've used have the cfc in the same folder as
::the calling document, so it hasn't been an issue.
::
::Now that it is, I can't figure out how to satisfy the cfinvoke
::function concerning the path to a cfc other that in the same folder
::as the calling document.
::
::I tried the source attribute in the cfinvoke function, but that
::just returned an error any way I coded it.
::
::CF Admin Mappings?  IIS Mappings?  Virtual Directories?
::I know this is probably something simple, but I'm just not getting it.
::
::Hints, anyone?
::
::Thanks,
::
::Rick
::
::
::
:: -Original Message-
:: From: Gerald Guido [mailto:[EMAIL PROTECTED]
:: Sent: Monday, June 16, 2008 12:02 AM
:: To: CF-Talk
:: Subject: Re: cfc question...
::
::  Anyway, what's lame about putting all the cfc's together in a
::directory
:: where I can find them easily?
::
:: There is nothing lame about it (you gotta stick them somewhere). What he
:: means is that you are going to want to stick them in memory (the
::application
:: scope) cuz there is a lot of overhead with firing them up (instantiating
::or
:: creating an instance of them) every time you need to use them. Basically
::you
:: are caching them.
::
:: You can do the same thing with functions too. It is pretty damn slick. I
:: blarged on the matter here:
::
::http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions--
::Creating-variables-that-are
::-
:: executable
::
:: G$
::
::
:: On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth
::[EMAIL PROTECTED]
:: wrote:
::
::  Now, Will... all that's a bit complicated for a newbie to cfc's!
::  Didja haf'ta make it so hard! I just wanted a path! :o)
:: 
::  Anyway, what's lame about putting all the cfc's together in a
::directory
::  where I can find them easily?
:: 
:: 
::   -Original Message-
::   From: Will Tomlinson [mailto:[EMAIL PROTECTED]
::   Sent: Sunday, June 15, 2008 11:00 PM
::   To: CF-Talk
::   Subject: Re: cfc question...
::  
::   Another issue I've run into is how to help my calling page find
::   my cfc's.  While learning, I've just placed the cfc in the same
::   folder as the calling page.  But now I'm placing them in a
::components
::   folder and the calling page can't find it.
::  
::   Rick, I mostly initialize them in application scope in
::Application.cfc
::  
::   Like this:
::  
::   cfset APPLICATION.reportDAO =
::  CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
::  
::   Then build a constructor in your cfc like so:
::  
::   cffunction name=init access=public returntype=reportDAO
::  output=false
::  hint=Returns an instance of the CFC initialized with the
::correct
::  settings.
:: cfargument name=dsn
:: cfset variables.dsn = arguments.dsn
:: cfreturn this
::   /cffunction
::  
::   Once you do all that, it's ready to use anywhere in the application.
::  
::   Just refer to it using the application scope:
::  
::   cfset getReport = APPLICATION.reportDAO.monthEnd()
::  
::   Puttin it in a cfc's directory is lame, but I'm sure more advice
::will
::  roll in for ya.  :)
::  
::   hth,
::   Will
::  
::  
:: 
:: 
::
::
::
::

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307548
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: cfc question...

2008-06-16 Thread Jason Durham
Did you get it straightened out Rick?  Azadi gave you what you need.
You need to explicitly call the component using a path from the web root
(dot notation).

From Azadi's email...
cfinvoke component=dot.delimited.path.to.cfc.from.webroot
method=your_cfc_method_name_here ...

For your situation...
cfinvoke component=c21-ar.components.agent method=get_agent_info
returnvariable=agent_info agent_id=url.agent_id /




-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 15, 2008 11:57 PM
To: CF-Talk
Subject: RE: cfc question...

I looked over the info and I'm sure I'll end up doing that,
but I still have to execute the code at some point, which leads
me back to the question of how to set up paths for the cfc's.

Let's say I've got a root folder of
e:\inetpub\webroot\c21ar
and a component folder path of
e:\inetpub\webroot\c21ar\components

How do I set the path when using the cfinvoke function?
All the examples I've used have the cfc in the same folder as
the calling document, so it hasn't been an issue.

Now that it is, I can't figure out how to satisfy the cfinvoke
function concerning the path to a cfc other that in the same folder
as the calling document.

I tried the source attribute in the cfinvoke function, but that
just returned an error any way I coded it.

CF Admin Mappings?  IIS Mappings?  Virtual Directories?
I know this is probably something simple, but I'm just not getting it.

Hints, anyone?

Thanks,

Rick



 -Original Message-
 From: Gerald Guido [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 12:02 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
  Anyway, what's lame about putting all the cfc's together in a
directory
 where I can find them easily?
 
 There is nothing lame about it (you gotta stick them somewhere). What
he
 means is that you are going to want to stick them in memory (the
application
 scope) cuz there is a lot of overhead with firing them up
(instantiating or
 creating an instance of them) every time you need to use them.
Basically you
 are caching them.
 
 You can do the same thing with functions too. It is pretty damn slick.
I
 blarged on the matter here:

http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions-
-Creating-variables-that-are
-
 executable
 
 G$
 
 
 On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth
[EMAIL PROTECTED]
 wrote:
 
  Now, Will... all that's a bit complicated for a newbie to cfc's!
  Didja haf'ta make it so hard! I just wanted a path! :o)
 
  Anyway, what's lame about putting all the cfc's together in a
directory
  where I can find them easily?
 
 
   -Original Message-
   From: Will Tomlinson [mailto:[EMAIL PROTECTED]
   Sent: Sunday, June 15, 2008 11:00 PM
   To: CF-Talk
   Subject: Re: cfc question...
  
   Another issue I've run into is how to help my calling page find
   my cfc's.  While learning, I've just placed the cfc in the same
   folder as the calling page.  But now I'm placing them in a
components
   folder and the calling page can't find it.
  
   Rick, I mostly initialize them in application scope in
Application.cfc
  
   Like this:
  
   cfset APPLICATION.reportDAO =
 
CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
  
   Then build a constructor in your cfc like so:
  
   cffunction name=init access=public returntype=reportDAO
  output=false
  hint=Returns an instance of the CFC initialized with the
correct
  settings.
 cfargument name=dsn
 cfset variables.dsn = arguments.dsn
 cfreturn this
   /cffunction
  
   Once you do all that, it's ready to use anywhere in the
application.
  
   Just refer to it using the application scope:
  
   cfset getReport = APPLICATION.reportDAO.monthEnd()
  
   Puttin it in a cfc's directory is lame, but I'm sure more advice
will
  roll in for ya.  :)
  
   hth,
   Will
  
  
 
 
 
 



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307555
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question...

2008-06-16 Thread Carl Von Stetten
Rick,

A CF Admin mapping would be a reasonable approach.  For example, you 
might create a mapping /c21ar_cfcs (or whatever you want to name it) 
that points directly to e:\inetpub\webroot\c21ar\components.  Then, 
anywhere you need to access the CFC, you would use c21ar_cfcs.agent.  
Or in your case:

cfinvoke component='c21ar_cfcs.agent'
  method='get_agent_info'
  returnvariable='agent_info'
  agent_id='#url.agent_id#'

HTH,
Carl

Rick Faircloth wrote:
 I looked over the info and I'm sure I'll end up doing that,
 but I still have to execute the code at some point, which leads
 me back to the question of how to set up paths for the cfc's.

 Let's say I've got a root folder of
 e:\inetpub\webroot\c21ar
 and a component folder path of
 e:\inetpub\webroot\c21ar\components

 How do I set the path when using the cfinvoke function?
 All the examples I've used have the cfc in the same folder as
 the calling document, so it hasn't been an issue.

 Now that it is, I can't figure out how to satisfy the cfinvoke
 function concerning the path to a cfc other that in the same folder
 as the calling document.

 I tried the source attribute in the cfinvoke function, but that
 just returned an error any way I coded it.

 CF Admin Mappings?  IIS Mappings?  Virtual Directories?
 I know this is probably something simple, but I'm just not getting it.

 Hints, anyone?

 Thanks,

 Rick



   
 -Original Message-
 From: Gerald Guido [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 12:02 AM
 To: CF-Talk
 Subject: Re: cfc question...

 
 Anyway, what's lame about putting all the cfc's together in a directory
 
 where I can find them easily?

 There is nothing lame about it (you gotta stick them somewhere). What he
 means is that you are going to want to stick them in memory (the application
 scope) cuz there is a lot of overhead with firing them up (instantiating or
 creating an instance of them) every time you need to use them. Basically you
 are caching them.

 You can do the same thing with functions too. It is pretty damn slick. I
 blarged on the matter here:

 
 http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions--Creating-variables-that-are
 -
   
 executable

 G$


 On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth [EMAIL PROTECTED]
 wrote:

 
 Now, Will... all that's a bit complicated for a newbie to cfc's!
 Didja haf'ta make it so hard! I just wanted a path! :o)

 Anyway, what's lame about putting all the cfc's together in a directory
 where I can find them easily?


   
 -Original Message-
 From: Will Tomlinson [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 15, 2008 11:00 PM
 To: CF-Talk
 Subject: Re: cfc question...

 
 Another issue I've run into is how to help my calling page find
 my cfc's.  While learning, I've just placed the cfc in the same
 folder as the calling page.  But now I'm placing them in a components
 folder and the calling page can't find it.
   
 Rick, I mostly initialize them in application scope in Application.cfc

 Like this:

 cfset APPLICATION.reportDAO =
 
 CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
   
 Then build a constructor in your cfc like so:

 cffunction name=init access=public returntype=reportDAO
 
 output=false
   
hint=Returns an instance of the CFC initialized with the correct
 
 settings.
   
   cfargument name=dsn
   cfset variables.dsn = arguments.dsn
   cfreturn this
 /cffunction

 Once you do all that, it's ready to use anywhere in the application.

 Just refer to it using the application scope:

 cfset getReport = APPLICATION.reportDAO.monthEnd()

 Puttin it in a cfc's directory is lame, but I'm sure more advice will
 
 roll in for ya.  :)
   
 hth,
 Will


 
   
 

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307556
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-16 Thread Rick Faircloth
Yes, I did get it, finally, Jason.  Thanks to you and everyone
who has given advice!  I've got a lot to think about and consider
making the change from .cfm and includes to cfc's, but I'm off to
a good start, I think.  The first step for me is to get something
*simple* to work and then to build my knowledge from there.

What was complicating my path problem was the fact that the main website
has a component folder and a certain webroot.

The folder that is holding the templates for the subdomains is also the
webroot folder for those subdomains.

I was trying to use the components in the main website's folder, which is
above the subdomain folder (webroot folder for subdomains) in the folder
hierarchy.  That wasn't working.

I think what I had to understand is that the dot notation and paths
for the cfc's is logical, not physical.  I was trying to figure out some
way to jump back up two folder levels and down one to get into the
main website component folder...wasn't working.

I finally just created a component folder in the subdomain root folder
and then I could easily access it.

Does my newbie confusion make any sense?

Rick



 -Original Message-
 From: Jason Durham [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 10:20 AM
 To: CF-Talk
 Subject: RE: cfc question...
 
 Did you get it straightened out Rick?  Azadi gave you what you need.
 You need to explicitly call the component using a path from the web root
 (dot notation).
 
 From Azadi's email...
 cfinvoke component=dot.delimited.path.to.cfc.from.webroot
 method=your_cfc_method_name_here ...
 
 For your situation...
 cfinvoke component=c21-ar.components.agent method=get_agent_info
 returnvariable=agent_info agent_id=url.agent_id /
 
 
 
 
 -Original Message-
 From: Rick Faircloth [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 15, 2008 11:57 PM
 To: CF-Talk
 Subject: RE: cfc question...
 
 I looked over the info and I'm sure I'll end up doing that,
 but I still have to execute the code at some point, which leads
 me back to the question of how to set up paths for the cfc's.
 
 Let's say I've got a root folder of
 e:\inetpub\webroot\c21ar
 and a component folder path of
 e:\inetpub\webroot\c21ar\components
 
 How do I set the path when using the cfinvoke function?
 All the examples I've used have the cfc in the same folder as
 the calling document, so it hasn't been an issue.
 
 Now that it is, I can't figure out how to satisfy the cfinvoke
 function concerning the path to a cfc other that in the same folder
 as the calling document.
 
 I tried the source attribute in the cfinvoke function, but that
 just returned an error any way I coded it.
 
 CF Admin Mappings?  IIS Mappings?  Virtual Directories?
 I know this is probably something simple, but I'm just not getting it.
 
 Hints, anyone?
 
 Thanks,
 
 Rick
 
 
 
  -Original Message-
  From: Gerald Guido [mailto:[EMAIL PROTECTED]
  Sent: Monday, June 16, 2008 12:02 AM
  To: CF-Talk
  Subject: Re: cfc question...
 
   Anyway, what's lame about putting all the cfc's together in a
 directory
  where I can find them easily?
 
  There is nothing lame about it (you gotta stick them somewhere). What
 he
  means is that you are going to want to stick them in memory (the
 application
  scope) cuz there is a lot of overhead with firing them up
 (instantiating or
  creating an instance of them) every time you need to use them.
 Basically you
  are caching them.
 
  You can do the same thing with functions too. It is pretty damn slick.
 I
  blarged on the matter here:
 
 http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions-
 -Creating-variables-that-are
 -
  executable
 
  G$
 
 
  On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth
 [EMAIL PROTECTED]
  wrote:
 
   Now, Will... all that's a bit complicated for a newbie to cfc's!
   Didja haf'ta make it so hard! I just wanted a path! :o)
  
   Anyway, what's lame about putting all the cfc's together in a
 directory
   where I can find them easily?
  
  
-Original Message-
From: Will Tomlinson [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2008 11:00 PM
To: CF-Talk
Subject: Re: cfc question...
   
Another issue I've run into is how to help my calling page find
my cfc's.  While learning, I've just placed the cfc in the same
folder as the calling page.  But now I'm placing them in a
 components
folder and the calling page can't find it.
   
Rick, I mostly initialize them in application scope in
 Application.cfc
   
Like this:
   
cfset APPLICATION.reportDAO =
  
 CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
   
Then build a constructor in your cfc like so:
   
cffunction name=init access=public returntype=reportDAO
   output=false
   hint=Returns an instance of the CFC initialized with the
 correct
   settings.
  cfargument name=dsn
  cfset variables.dsn = arguments.dsn
  cfreturn this
/cffunction
   
Once you

RE: cfc question...

2008-06-16 Thread Jason Durham
Ah... you were trying to use a relative path (../folder/cfcs/etc).
No-can-do. You have to provide an _absolute_ path to a component via
cfinvoke and createObject() using dot notation.  



-Original Message-
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 16, 2008 1:59 PM
To: CF-Talk
Subject: RE: cfc question...

Yes, I did get it, finally, Jason.  Thanks to you and everyone
who has given advice!  I've got a lot to think about and consider
making the change from .cfm and includes to cfc's, but I'm off to
a good start, I think.  The first step for me is to get something
*simple* to work and then to build my knowledge from there.

What was complicating my path problem was the fact that the main website
has a component folder and a certain webroot.

The folder that is holding the templates for the subdomains is also the
webroot folder for those subdomains.

I was trying to use the components in the main website's folder, which
is
above the subdomain folder (webroot folder for subdomains) in the folder
hierarchy.  That wasn't working.

I think what I had to understand is that the dot notation and paths
for the cfc's is logical, not physical.  I was trying to figure out
some
way to jump back up two folder levels and down one to get into the
main website component folder...wasn't working.

I finally just created a component folder in the subdomain root folder
and then I could easily access it.

Does my newbie confusion make any sense?

Rick



 -Original Message-
 From: Jason Durham [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 10:20 AM
 To: CF-Talk
 Subject: RE: cfc question...
 
 Did you get it straightened out Rick?  Azadi gave you what you need.
 You need to explicitly call the component using a path from the web
root
 (dot notation).
 
 From Azadi's email...
 cfinvoke component=dot.delimited.path.to.cfc.from.webroot
 method=your_cfc_method_name_here ...
 
 For your situation...
 cfinvoke component=c21-ar.components.agent method=get_agent_info
 returnvariable=agent_info agent_id=url.agent_id /
 
 
 
 
 -Original Message-
 From: Rick Faircloth [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 15, 2008 11:57 PM
 To: CF-Talk
 Subject: RE: cfc question...
 
 I looked over the info and I'm sure I'll end up doing that,
 but I still have to execute the code at some point, which leads
 me back to the question of how to set up paths for the cfc's.
 
 Let's say I've got a root folder of
 e:\inetpub\webroot\c21ar
 and a component folder path of
 e:\inetpub\webroot\c21ar\components
 
 How do I set the path when using the cfinvoke function?
 All the examples I've used have the cfc in the same folder as
 the calling document, so it hasn't been an issue.
 
 Now that it is, I can't figure out how to satisfy the cfinvoke
 function concerning the path to a cfc other that in the same folder
 as the calling document.
 
 I tried the source attribute in the cfinvoke function, but that
 just returned an error any way I coded it.
 
 CF Admin Mappings?  IIS Mappings?  Virtual Directories?
 I know this is probably something simple, but I'm just not getting it.
 
 Hints, anyone?
 
 Thanks,
 
 Rick
 
 
 
  -Original Message-
  From: Gerald Guido [mailto:[EMAIL PROTECTED]
  Sent: Monday, June 16, 2008 12:02 AM
  To: CF-Talk
  Subject: Re: cfc question...
 
   Anyway, what's lame about putting all the cfc's together in a
 directory
  where I can find them easily?
 
  There is nothing lame about it (you gotta stick them somewhere).
What
 he
  means is that you are going to want to stick them in memory (the
 application
  scope) cuz there is a lot of overhead with firing them up
 (instantiating or
  creating an instance of them) every time you need to use them.
 Basically you
  are caching them.
 
  You can do the same thing with functions too. It is pretty damn
slick.
 I
  blarged on the matter here:
 

http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions-
 -Creating-variables-that-are
 -
  executable
 
  G$
 
 
  On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth
 [EMAIL PROTECTED]
  wrote:
 
   Now, Will... all that's a bit complicated for a newbie to cfc's!
   Didja haf'ta make it so hard! I just wanted a path! :o)
  
   Anyway, what's lame about putting all the cfc's together in a
 directory
   where I can find them easily?
  
  
-Original Message-
From: Will Tomlinson [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2008 11:00 PM
To: CF-Talk
Subject: Re: cfc question...
   
Another issue I've run into is how to help my calling page find
my cfc's.  While learning, I've just placed the cfc in the same
folder as the calling page.  But now I'm placing them in a
 components
folder and the calling page can't find it.
   
Rick, I mostly initialize them in application scope in
 Application.cfc
   
Like this:
   
cfset APPLICATION.reportDAO =
  
 CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn

Re: cfc question...

2008-06-16 Thread Gerald Guido
You have to provide an _absolute_ path to a component via
cfinvoke and createObject() using dot notation.

You can get around that by doing something like this

cfset YourPathToCFCDir  = com.cf.model.

cfinvoke component=#YourPathToCFCDir#YourCFC
method=init
returnvariable=retinit
cfinvokeargument name=xslBasePath value=#someVar/
/cfinvoke


CreateObject(component, #YourPathToCFCDir#YourOtherCFC)


HTH

G$

-- 
If everything seems under control, you're not going fast enough
-- Mario Andretti


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307565
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-16 Thread Rick Faircloth
Ok, let me see if I'm understanding this...

cfset agentLibrary =
createObject(component,components.agents.agent).init(
datasourcename ) /

The part above goes in the calling page before the cfinvoke
statement, right?  If so, how does this work with the cfinvoke statement?
Is agentLibrary above becoming the variable that will hold
all the data returned by the cfc function, agent?

And I've always defined my db's using
cfset dsn='datasource'
in my application.cfm file, so if I continue doing that, then
I guess the creation of the agentLibrary variable above would be:

cfset agentLibrary = createObject('component', 
'components.agents.agent').init(#dsn#) /
or something?

Or would defining the variable 'dsn' in my application.cfm become
an obsolete practice in the 'cfc era'???

Also, in your code below, I don't see the variable 'agentLibrary' being used
after creation (instantiation?)...so how does it fit into the cfc functionality?

Rick


 -Original Message-
 From: Mike Kear [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 1:29 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
 Ok syntax error  forgot the closing quotes.   Make that:
 
 
 cfset agentLibrary = createObject(component,components.agents.agent) /
 
 
 And usually at the top of an object like that (if it's for the kinds
 of things i think it is) you would have an init() functionthat you
 tell the component the datasource name. That looks something like:
 
 !--- Constructor / initialisation ---
 cffunction name=init access=Public returntype=agent
 output=false hint=Initialises the component
 cfargument name=datasourcename required=true type=string /
   cfset variables.dsn = arguments.datasourcename /
   cfreturn this /
 /cffunction
 
 
 It seems a bit of extra typing to have that at the top of your cfc,
 but for reasons of encapsulation (sorry for using the jargon!)  its
 best to have the cfc so that if it needs to know something you'll tell
 it, rather than have it rely on finding what it needs in application
 or session scope or something.So if you have that init() function
 in your component, you'd instantiate it by chaining the .init() method
 when you invoke it.  ( You can chain methods one behind the other )
 
 cfset agentLibrary =
 createObject(component,components.agents.agent).init(
 datasourcename ) /
 
 Throughout your cfc, wherever any function needs to run a query on the
 datasource, it will do it like so:
 
 cfquery name=qThisQuery datasource=#variables.dsn#
SELECT AgentID from Agents
   WHERE  GRPOffCE = cfqueryparam value=#officeid#
 cfsqltype=cf_sql_varchar/
 /cfquery
 
 
 That way you can easily reuse the component without having to need the
 datasource to exist in application scope or anywhere else for that
 matter.  The cfc needs to know the datasourcename so you tell it that
 when you instantiate the cfc.
 
 
 Cheers
 Mike Kear
 Windsor, NSW, Australia
 Adobe Certified Advanced ColdFusion Developer
 AFP Webworks
 http://afpwebworks.com
 ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month
 
 
 
 On Mon, Jun 16, 2008 at 3:15 PM, Mike Kear [EMAIL PROTECTED] wrote:
  I think you're nearly there, Rick.Just make sure you are following
  the rules about how to set out paths for components:
 
  if your component is in
  e:\inetpub\webroot\c21ar\components\agents\agent.cfc   and the web
  root is at e:\inetpub\webroot\c21ar,  then you would invoke the
  component with the following: (Instantiate is another term that
  confused me at first - how is 'instantiate' different from'invoke'?
  answer:  it's the same thing)
 
  cfset agentLibrary = createObject(component,components.agents.agent) /
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307566
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question...

2008-06-15 Thread Brian Kotek
On Sun, Jun 15, 2008 at 3:43 PM, Rick Faircloth [EMAIL PROTECTED]
wrote:

 Let's say I have link on a page back to itself:

 a href='page.cfm?agent_id=20'Get Agent/a

 Then I have this in my page.cfm to invoke a cfc
 called 'agent.cfc':

 cfinvoke component='agent'
  method='get_agent_info'
  returnvariable='agent_info'
  agent_id='#url.agent_id#'


 My 'agent.cfc' looks like this:

 cffunction access='remote' name='get_agent_info' output='0'
 returntype='query'


 cfargument name='agent_id' type='string' required='1'/


 cfquery name='get_agent' datasource='x'

  select * from our_agents where agent_id = '#arguments.agent_id#'

 /cfquery

 cfif get_agent.recordcount
  cfreturn get_agent/
 cfelse
  cfreturn 0/
 /cfif

 /cffunction


You should var-scope your query variable. Also, you can't just return 0 if
the query has no data, since you have specified the return type as query
and 0 is not a query. Finally, the function doesn't need to be
access=remote unless you plan to call this as a web service or through
AMF.



 Now, let's say the invocation is successful and I have extracted query
 data.
 I know how to access all the query data back on the calling page (it seems
 counter-intuitive that the cfreturn variable, 'get_agent' in my example
 above,
 is referenced or 'renamed as 'agent_info' as the returnvariable in the
 cfinvoke...
 why the renaming?).


It's actually not counter-intuitive. Your calling code does not and should
not know anything about the internal implementation of your method. So
whatever variable you use within the method is not visible to anything
outside of the method. This is encapsulation, and it is the most fundamental
principle that underlies OOP. So nothing is actually renamed; when you
call the method you are explicitly assigning the result to the variable
agent_info, the same way you would with any other variable assignment.


 However, in my app I'm converting all the agent data from the query into
 session
 variables to customize my templates.

 Is there a way to do that in the .cfc or should I handle that back on my
 calling .cfm page?
 If I handle it in the .cfc, which I'd prefer in order to keep all
 processing out of the
 display page code, how would I return the session variables to the calling
 page?


This should be handled by the CFC, your views should be as agnostic as
possible about how they are used. If you want to cache this in the session
scope you could do something like:

cffunction access='remote' name='get_agent_info' output='0'
returntype='query'
cfargument name='agent_id' type='string' required='1'/
cfset var get_agent =  /

cfif not StructKeyExists(session, 'get_agent')
cfquery name='get_agent' datasource='x'
 select * from our_agents where agent_id = '#arguments.agent_id#'
/cfquery
cfset session.get_agent = get_agent /
/cfif

cfreturn session.get_agent/

/cffunction

Which will set the variable into the session scope the first time you call
this method, but will return the value from the session scope for all
subsequent requests within the same session.

Hope that helps,

Brian


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307529
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-15 Thread Rick Faircloth
Thanks for the reply, Brian.  I see what you mean about the
agnosticism of the view.

Thanks, also, for the tip on handling the session variables.
and the rest of the comments.

Another issue I've run into is how to help my calling page find
my cfc's.  While learning, I've just placed the cfc in the same
folder as the calling page.  But now I'm placing them in a components
folder and the calling page can't find it.

My current folder structure is a little strange because I have
a folder for subdomain templates inside main site's folder.

So I have my main site in this structure:
e:\inetpub\webroot\c21-ar\index.cfm

There is also a 'components' folder at:
e:\inetpub\webroot\c21-ar\components

My subdomains main folder is at:
e:\inetpub\webroot\c21-ar\agents

How can I run this page:
e:\inetpub\webroot\c21-ar\agents\index.cfm

and have it call a cfc at:
e:\inetpub\webroot\c21-ar\components\agents.cfc

???

Do I need to set up mappings in CF Admin or create a virtual
directory in IIS, perhaps?  I've tried numerous approaches,
but nothing has worked.

Thanks, again,

Rick

 -Original Message-
 From: Brian Kotek [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 15, 2008 9:19 PM
 To: CF-Talk
 Subject: Re: cfc question...
 
 You should var-scope your query variable. Also, you can't just return 0 if
 the query has no data, since you have specified the return type as query
 and 0 is not a query. Finally, the function doesn't need to be
 access=remote unless you plan to call this as a web service or through
 AMF.
 
 
 
  Now, let's say the invocation is successful and I have extracted query
  data.
  I know how to access all the query data back on the calling page (it seems
  counter-intuitive that the cfreturn variable, 'get_agent' in my example
  above,
  is referenced or 'renamed as 'agent_info' as the returnvariable in the
  cfinvoke...
  why the renaming?).
 
 
 It's actually not counter-intuitive. Your calling code does not and should
 not know anything about the internal implementation of your method. So
 whatever variable you use within the method is not visible to anything
 outside of the method. This is encapsulation, and it is the most fundamental
 principle that underlies OOP. So nothing is actually renamed; when you
 call the method you are explicitly assigning the result to the variable
 agent_info, the same way you would with any other variable assignment.
 
 
  However, in my app I'm converting all the agent data from the query into
  session
  variables to customize my templates.
 
  Is there a way to do that in the .cfc or should I handle that back on my
  calling .cfm page?
  If I handle it in the .cfc, which I'd prefer in order to keep all
  processing out of the
  display page code, how would I return the session variables to the calling
  page?
 
 
 This should be handled by the CFC, your views should be as agnostic as
 possible about how they are used. If you want to cache this in the session
 scope you could do something like:
 
 cffunction access='remote' name='get_agent_info' output='0'
 returntype='query'
 cfargument name='agent_id' type='string' required='1'/
 cfset var get_agent =  /
 
 cfif not StructKeyExists(session, 'get_agent')
 cfquery name='get_agent' datasource='x'
  select * from our_agents where agent_id = '#arguments.agent_id#'
 /cfquery
 cfset session.get_agent = get_agent /
 /cfif
 
 cfreturn session.get_agent/
 
 /cffunction
 
 Which will set the variable into the session scope the first time you call
 this method, but will return the value from the session scope for all
 subsequent requests within the same session.
 
 Hope that helps,
 
 Brian
 



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307531
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question...

2008-06-15 Thread Azadi Saryev
invoke your agents.cfc as c21-ar.components.agents
cf expects a path from web root if the component is not in same folder.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/



Rick Faircloth wrote:
 Thanks for the reply, Brian.  I see what you mean about the
 agnosticism of the view.

 Thanks, also, for the tip on handling the session variables.
 and the rest of the comments.

 Another issue I've run into is how to help my calling page find
 my cfc's.  While learning, I've just placed the cfc in the same
 folder as the calling page.  But now I'm placing them in a components
 folder and the calling page can't find it.

 My current folder structure is a little strange because I have
 a folder for subdomain templates inside main site's folder.

 So I have my main site in this structure:
 e:\inetpub\webroot\c21-ar\index.cfm

 There is also a 'components' folder at:
 e:\inetpub\webroot\c21-ar\components

 My subdomains main folder is at:
 e:\inetpub\webroot\c21-ar\agents

 How can I run this page:
 e:\inetpub\webroot\c21-ar\agents\index.cfm

 and have it call a cfc at:
 e:\inetpub\webroot\c21-ar\components\agents.cfc

 ???

 Do I need to set up mappings in CF Admin or create a virtual
 directory in IIS, perhaps?  I've tried numerous approaches,
 but nothing has worked.

 Thanks, again,

 Rick


   

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307532
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question...

2008-06-15 Thread Will Tomlinson
Another issue I've run into is how to help my calling page find
my cfc's.  While learning, I've just placed the cfc in the same
folder as the calling page.  But now I'm placing them in a components
folder and the calling page can't find it.

Rick, I mostly initialize them in application scope in Application.cfc

Like this:

cfset APPLICATION.reportDAO = 
CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn) 

Then build a constructor in your cfc like so:

cffunction name=init access=public returntype=reportDAO output=false
 hint=Returns an instance of the CFC initialized with the correct 
settings.
  cfargument name=dsn
  cfset variables.dsn = arguments.dsn
  cfreturn this
/cffunction

Once you do all that, it's ready to use anywhere in the application. 

Just refer to it using the application scope:

cfset getReport = APPLICATION.reportDAO.monthEnd()

Puttin it in a cfc's directory is lame, but I'm sure more advice will roll in 
for ya.  :)

hth,
Will 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307533
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-15 Thread Rick Faircloth
Now, Will... all that's a bit complicated for a newbie to cfc's!
Didja haf'ta make it so hard! I just wanted a path! :o)

Anyway, what's lame about putting all the cfc's together in a directory
where I can find them easily?


 -Original Message-
 From: Will Tomlinson [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 15, 2008 11:00 PM
 To: CF-Talk
 Subject: Re: cfc question...
 
 Another issue I've run into is how to help my calling page find
 my cfc's.  While learning, I've just placed the cfc in the same
 folder as the calling page.  But now I'm placing them in a components
 folder and the calling page can't find it.
 
 Rick, I mostly initialize them in application scope in Application.cfc
 
 Like this:
 
 cfset APPLICATION.reportDAO =
CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
 
 Then build a constructor in your cfc like so:
 
 cffunction name=init access=public returntype=reportDAO output=false
hint=Returns an instance of the CFC initialized with the correct 
 settings.
   cfargument name=dsn
   cfset variables.dsn = arguments.dsn
   cfreturn this
 /cffunction
 
 Once you do all that, it's ready to use anywhere in the application.
 
 Just refer to it using the application scope:
 
 cfset getReport = APPLICATION.reportDAO.monthEnd()
 
 Puttin it in a cfc's directory is lame, but I'm sure more advice will roll in 
 for ya.  :)
 
 hth,
 Will
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307534
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question...

2008-06-15 Thread Azadi Saryev
there's nothing lame about it.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/



Rick Faircloth wrote:
 Now, Will... all that's a bit complicated for a newbie to cfc's!
 Didja haf'ta make it so hard! I just wanted a path! :o)

 Anyway, what's lame about putting all the cfc's together in a directory
 where I can find them easily?


   

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307535
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question...

2008-06-15 Thread Gerald Guido
 Anyway, what's lame about putting all the cfc's together in a directory
where I can find them easily?

There is nothing lame about it (you gotta stick them somewhere). What he
means is that you are going to want to stick them in memory (the application
scope) cuz there is a lot of overhead with firing them up (instantiating or
creating an instance of them) every time you need to use them. Basically you
are caching them.

You can do the same thing with functions too. It is pretty damn slick. I
blarged on the matter here:
http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions--Creating-variables-that-are-executable

G$


On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth [EMAIL PROTECTED]
wrote:

 Now, Will... all that's a bit complicated for a newbie to cfc's!
 Didja haf'ta make it so hard! I just wanted a path! :o)

 Anyway, what's lame about putting all the cfc's together in a directory
 where I can find them easily?


  -Original Message-
  From: Will Tomlinson [mailto:[EMAIL PROTECTED]
  Sent: Sunday, June 15, 2008 11:00 PM
  To: CF-Talk
  Subject: Re: cfc question...
 
  Another issue I've run into is how to help my calling page find
  my cfc's.  While learning, I've just placed the cfc in the same
  folder as the calling page.  But now I'm placing them in a components
  folder and the calling page can't find it.
 
  Rick, I mostly initialize them in application scope in Application.cfc
 
  Like this:
 
  cfset APPLICATION.reportDAO =
 CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
 
  Then build a constructor in your cfc like so:
 
  cffunction name=init access=public returntype=reportDAO
 output=false
 hint=Returns an instance of the CFC initialized with the correct
 settings.
cfargument name=dsn
cfset variables.dsn = arguments.dsn
cfreturn this
  /cffunction
 
  Once you do all that, it's ready to use anywhere in the application.
 
  Just refer to it using the application scope:
 
  cfset getReport = APPLICATION.reportDAO.monthEnd()
 
  Puttin it in a cfc's directory is lame, but I'm sure more advice will
 roll in for ya.  :)
 
  hth,
  Will
 
 

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307536
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-15 Thread Rick Faircloth
I'll check out the info... thanks, Guido!


 -Original Message-
 From: Gerald Guido [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 12:02 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
  Anyway, what's lame about putting all the cfc's together in a directory
 where I can find them easily?
 
 There is nothing lame about it (you gotta stick them somewhere). What he
 means is that you are going to want to stick them in memory (the application
 scope) cuz there is a lot of overhead with firing them up (instantiating or
 creating an instance of them) every time you need to use them. Basically you
 are caching them.
 
 You can do the same thing with functions too. It is pretty damn slick. I
 blarged on the matter here:

http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions--Creating-variables-that-are
-
 executable
 
 G$
 
 
 On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth [EMAIL PROTECTED]
 wrote:
 
  Now, Will... all that's a bit complicated for a newbie to cfc's!
  Didja haf'ta make it so hard! I just wanted a path! :o)
 
  Anyway, what's lame about putting all the cfc's together in a directory
  where I can find them easily?
 
 
   -Original Message-
   From: Will Tomlinson [mailto:[EMAIL PROTECTED]
   Sent: Sunday, June 15, 2008 11:00 PM
   To: CF-Talk
   Subject: Re: cfc question...
  
   Another issue I've run into is how to help my calling page find
   my cfc's.  While learning, I've just placed the cfc in the same
   folder as the calling page.  But now I'm placing them in a components
   folder and the calling page can't find it.
  
   Rick, I mostly initialize them in application scope in Application.cfc
  
   Like this:
  
   cfset APPLICATION.reportDAO =
  CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
  
   Then build a constructor in your cfc like so:
  
   cffunction name=init access=public returntype=reportDAO
  output=false
  hint=Returns an instance of the CFC initialized with the correct
  settings.
 cfargument name=dsn
 cfset variables.dsn = arguments.dsn
 cfreturn this
   /cffunction
  
   Once you do all that, it's ready to use anywhere in the application.
  
   Just refer to it using the application scope:
  
   cfset getReport = APPLICATION.reportDAO.monthEnd()
  
   Puttin it in a cfc's directory is lame, but I'm sure more advice will
  roll in for ya.  :)
  
   hth,
   Will
  
  
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307537
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question...

2008-06-15 Thread Mike Kear
Rick, I'm delighted to see you starting to work with the power of
CFCs.   I also had the same confusion as you did at first.  The
terminology for some of these OO concepts gets a bit confusing, so
perhaps i can help you by expressing some of the ideas related without
using the teminology.

Perhaps it might help to see your code with notation for the same thing. ..

cfset agent_info = agent.get_agent_info( #url.agent_id# ) /

Here you're naming a query variable agent_info, and it's being
populated with records from a function called agent.get_agent_into()
which has been given the parameter #url.agent_id#.That's exactly
equivalent to your code:

cfinvoke component='agent'
  method='get_agent_info'
  returnvariable='agent_info'
  agent_id='#url.agent_id#'

 (Although you dont need the hash signs around the url variable, so it
would more properly be expressed: cfset agent_info =
agent.get_agent_info( url.agent_id ) /  )

Compare this to something you've been using for a long time already like:

cfset variable1 = dateformat( createdate, d/mm/) /

You dont need to know how dateformat goes about its business of
transforming your variable in order to use it.  All the work is done
inside the function dateformat().  It's the same inside your function
agent.get_agent_info()

Now the function get_agent_info() has a limited number of things it
needs to know, and doesnt care about the rest of the world.   All it
wants to know is the agent_id it has to look up, and the datasource
name.It doesnt care about anything else, nor should it either.
This is the concept of 'encapsulation' which means briefly, that each
function has a specific thing it does, and it shouldnt know (or need
to know) anything except what you tell it.

That's just like the function dateformat() that you've been using
since you started with ColdFusion so long ago.  It doesnt know what
you're using the date for, where the date came from or anything else.
All it knows is you give it a date object and it gives you back a
string.

Does that help you?

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month


On Mon, Jun 16, 2008 at 5:43 AM, Rick Faircloth
[EMAIL PROTECTED] wrote:
 Let's say I have link on a page back to itself:

 a href='page.cfm?agent_id=20'Get Agent/a

 Then I have this in my page.cfm to invoke a cfc
 called 'agent.cfc':

 cfinvoke component='agent'
  method='get_agent_info'
  returnvariable='agent_info'
  agent_id='#url.agent_id#'


 My 'agent.cfc' looks like this:

 cffunction access='remote' name='get_agent_info' output='0' 
 returntype='query'


 cfargument name='agent_id' type='string' required='1'/


 cfquery name='get_agent' datasource='x'

  select * from our_agents where agent_id = '#arguments.agent_id#'

 /cfquery

 cfif get_agent.recordcount
  cfreturn get_agent/
 cfelse
  cfreturn 0/
 /cfif

 /cffunction

 Now, let's say the invocation is successful and I have extracted query data.
 I know how to access all the query data back on the calling page (it seems
 counter-intuitive that the cfreturn variable, 'get_agent' in my example 
 above,
 is referenced or 'renamed as 'agent_info' as the returnvariable in the 
 cfinvoke...
 why the renaming?).

 However, in my app I'm converting all the agent data from the query into 
 session
 variables to customize my templates.

 Is there a way to do that in the .cfc or should I handle that back on my 
 calling .cfm page?
 If I handle it in the .cfc, which I'd prefer in order to keep all processing 
 out of the
 display page code, how would I return the session variables to the calling 
 page?

 Thanks for any input!

 Rick


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307538
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: cfc question...

2008-06-15 Thread Rick Faircloth
I looked over the info and I'm sure I'll end up doing that,
but I still have to execute the code at some point, which leads
me back to the question of how to set up paths for the cfc's.

Let's say I've got a root folder of
e:\inetpub\webroot\c21ar
and a component folder path of
e:\inetpub\webroot\c21ar\components

How do I set the path when using the cfinvoke function?
All the examples I've used have the cfc in the same folder as
the calling document, so it hasn't been an issue.

Now that it is, I can't figure out how to satisfy the cfinvoke
function concerning the path to a cfc other that in the same folder
as the calling document.

I tried the source attribute in the cfinvoke function, but that
just returned an error any way I coded it.

CF Admin Mappings?  IIS Mappings?  Virtual Directories?
I know this is probably something simple, but I'm just not getting it.

Hints, anyone?

Thanks,

Rick



 -Original Message-
 From: Gerald Guido [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 12:02 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
  Anyway, what's lame about putting all the cfc's together in a directory
 where I can find them easily?
 
 There is nothing lame about it (you gotta stick them somewhere). What he
 means is that you are going to want to stick them in memory (the application
 scope) cuz there is a lot of overhead with firing them up (instantiating or
 creating an instance of them) every time you need to use them. Basically you
 are caching them.
 
 You can do the same thing with functions too. It is pretty damn slick. I
 blarged on the matter here:

http://www.myinternetisbroken.com/index.cfm/2008/5/24/Caching-Functions--Creating-variables-that-are
-
 executable
 
 G$
 
 
 On Sun, Jun 15, 2008 at 11:49 PM, Rick Faircloth [EMAIL PROTECTED]
 wrote:
 
  Now, Will... all that's a bit complicated for a newbie to cfc's!
  Didja haf'ta make it so hard! I just wanted a path! :o)
 
  Anyway, what's lame about putting all the cfc's together in a directory
  where I can find them easily?
 
 
   -Original Message-
   From: Will Tomlinson [mailto:[EMAIL PROTECTED]
   Sent: Sunday, June 15, 2008 11:00 PM
   To: CF-Talk
   Subject: Re: cfc question...
  
   Another issue I've run into is how to help my calling page find
   my cfc's.  While learning, I've just placed the cfc in the same
   folder as the calling page.  But now I'm placing them in a components
   folder and the calling page can't find it.
  
   Rick, I mostly initialize them in application scope in Application.cfc
  
   Like this:
  
   cfset APPLICATION.reportDAO =
  CreateObject(component,cfcs.reportDAO).init(dsn=APPLICATION.dsn)
  
   Then build a constructor in your cfc like so:
  
   cffunction name=init access=public returntype=reportDAO
  output=false
  hint=Returns an instance of the CFC initialized with the correct
  settings.
 cfargument name=dsn
 cfset variables.dsn = arguments.dsn
 cfreturn this
   /cffunction
  
   Once you do all that, it's ready to use anywhere in the application.
  
   Just refer to it using the application scope:
  
   cfset getReport = APPLICATION.reportDAO.monthEnd()
  
   Puttin it in a cfc's directory is lame, but I'm sure more advice will
  roll in for ya.  :)
  
   hth,
   Will
  
  
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307539
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question...

2008-06-15 Thread Azadi Saryev
you can always use:

cfinvoke component=dot.delimited.path.to.cfc.from.webroot
method=your_cfc_method_name_here ...

same dor notation goes for createobject() function and cfobject tag

did my first comment not come through on the list yet? i do have it in
my email inbox...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307540
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question...

2008-06-15 Thread Rick Faircloth
Yes, that's a good explanation of the encapsulation perspective
and code.

See the message I just posted for even more basic info on trying
to help a cfinvoke function locate a cfc.  Unless I put it in the
same folder as the calling page, I get an error saying it can't be
found no matter how I try to set up a path using the source attribute, etc.

???

Rick

 -Original Message-
 From: Mike Kear [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 16, 2008 12:50 AM
 To: CF-Talk
 Subject: Re: cfc question...
 
 Rick, I'm delighted to see you starting to work with the power of
 CFCs.   I also had the same confusion as you did at first.  The
 terminology for some of these OO concepts gets a bit confusing, so
 perhaps i can help you by expressing some of the ideas related without
 using the teminology.
 
 Perhaps it might help to see your code with notation for the same thing. 
 ..
 
 cfset agent_info = agent.get_agent_info( #url.agent_id# ) /
 
 Here you're naming a query variable agent_info, and it's being
 populated with records from a function called agent.get_agent_into()
 which has been given the parameter #url.agent_id#.That's exactly
 equivalent to your code:
 
 cfinvoke component='agent'
   method='get_agent_info'
   returnvariable='agent_info'
   agent_id='#url.agent_id#'
 
  (Although you dont need the hash signs around the url variable, so it
 would more properly be expressed: cfset agent_info =
 agent.get_agent_info( url.agent_id ) /  )
 
 Compare this to something you've been using for a long time already like:
 
 cfset variable1 = dateformat( createdate, d/mm/) /
 
 You dont need to know how dateformat goes about its business of
 transforming your variable in order to use it.  All the work is done
 inside the function dateformat().  It's the same inside your function
 agent.get_agent_info()
 
 Now the function get_agent_info() has a limited number of things it
 needs to know, and doesnt care about the rest of the world.   All it
 wants to know is the agent_id it has to look up, and the datasource
 name.It doesnt care about anything else, nor should it either.
 This is the concept of 'encapsulation' which means briefly, that each
 function has a specific thing it does, and it shouldnt know (or need
 to know) anything except what you tell it.
 
 That's just like the function dateformat() that you've been using
 since you started with ColdFusion so long ago.  It doesnt know what
 you're using the date for, where the date came from or anything else.
 All it knows is you give it a date object and it gives you back a
 string.
 
 Does that help you?
 
 Cheers
 Mike Kear
 Windsor, NSW, Australia
 Adobe Certified Advanced ColdFusion Developer
 AFP Webworks
 http://afpwebworks.com
 ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month
 
 
 On Mon, Jun 16, 2008 at 5:43 AM, Rick Faircloth
 [EMAIL PROTECTED] wrote:
  Let's say I have link on a page back to itself:
 
  a href='page.cfm?agent_id=20'Get Agent/a
 
  Then I have this in my page.cfm to invoke a cfc
  called 'agent.cfc':
 
  cfinvoke component='agent'
   method='get_agent_info'
   returnvariable='agent_info'
   agent_id='#url.agent_id#'
 
 
  My 'agent.cfc' looks like this:
 
  cffunction access='remote' name='get_agent_info' output='0' 
  returntype='query'
 
 
  cfargument name='agent_id' type='string' required='1'/
 
 
  cfquery name='get_agent' datasource='x'
 
   select * from our_agents where agent_id = '#arguments.agent_id#'
 
  /cfquery
 
  cfif get_agent.recordcount
   cfreturn get_agent/
  cfelse
   cfreturn 0/
  /cfif
 
  /cffunction
 
  Now, let's say the invocation is successful and I have extracted query data.
  I know how to access all the query data back on the calling page (it seems
  counter-intuitive that the cfreturn variable, 'get_agent' in my example 
  above,
  is referenced or 'renamed as 'agent_info' as the returnvariable in the 
  cfinvoke...
  why the renaming?).
 
  However, in my app I'm converting all the agent data from the query into 
  session
  variables to customize my templates.
 
  Is there a way to do that in the .cfc or should I handle that back on my 
  calling .cfm page?
  If I handle it in the .cfc, which I'd prefer in order to keep all 
  processing out of the
  display page code, how would I return the session variables to the calling 
  page?
 
  Thanks for any input!
 
  Rick
 
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307541
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question

2007-07-20 Thread Tom Chiverton
On Wednesday 18 Jul 2007, [EMAIL PROTECTED] wrote:
 As far as security im not sure how using the array is any better.
.
 I suppose once things are broken out using the array I could then validate
 the data coming in with cfqueryparam.
 This would keep people from tacking on sub­queries and injecting their own
 SQL statements.

You've answered your own question there :-)

-- 
Tom Chiverton



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.


~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284178
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question

2007-07-18 Thread Dan Vega
Chad,
Here is what I do in that situation. First my select statement by default
will return all rows

SELECT *
FROM FlexoDirectConfigFiles
WHERE 1=1

1 will always be eqal to 1 so this is an easy way of getting all records and
allowing for optional and clauses then you can do this; Pass in optional
arguments to your function. You want to make these arguments not required
that way can pass as many or as few filters to your function as possible.
The code below may not be right I just threw it together quickly, but
hopefully you get the idea.

cfargument name=arg1 type=string required=false
cfargument name=arg1 type=string required=false


cfquery ...
SELECT *
FROM FlexoDirectConfigFiles
WHERE 1=1
cfif structKeyExists(arguments,arg1)
AND column = cfqueryparam value=#arguments.arg1#
/cfif
cfif structKeyExists(arguments,arg2)
AND column = cfqueryparam value=#arguments.arg2#
/cfif
/cfquery



On 7/18/07, Chad Gray [EMAIL PROTECTED] wrote:

 I have a CRUD CFC that has this function and I load the CFC into the
 application scope:

 cffunction name=readZJF access=public returntype=query
 cfargument name=criteria type=string required=yes

 cfquery datasource=dsn name=readZJF
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE #arguments.criteria#
 /cfquery

 cfreturn readZJF
 /cffunction

 I want to be able to pass in the WHERE statement into it.  So it could
 be:
 FileName = 'PLATES.zjf' AND FileModificationDate = '09/30/2005 12:34:01
 PM'

 So I run something like this to call the function:

 cfset DoesFileAlreadyExist = application.ZJF.readZJF(FileName =
 '#getZJF_files.name#' AND FileModificationDate =
 '#getZJF_files.dateLastModified#')

 What I get back is an error:
 [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '
 PLATES.zjf'.

 Then I look at the SQL that was run in debugging.
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE FileName = ''PLATES.zjf'' AND FileModificationDate = ''09/30/2005
 12:34:01 PM''

 Why did it take my single quotes and add another single quote?  Is it
 trying to escape the single quote?  How do I keep it from doing this?


 

~|
ColdFusion 8 beta – Build next generation applications today.
Free beta download on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283994
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: cfc question

2007-07-18 Thread Tom Chiverton
On Wednesday 18 Jul 2007, [EMAIL PROTECTED] wrote:
 I have a CRUD CFC that has this function and I load the CFC into the
 application scope:

 cffunction name=readZJF access=public returntype=query
   cfargument name=criteria type=string required=yes

cfset var readZJF=''/

   cfquery datasource=dsn name=readZJF
   SELECT *
   FROM FlexoDirectConfigFiles
   WHERE #arguments.criteria#
   /cfquery

cfquery datasource=dsn name=readZJF
SELECT *
FROM FlexoDirectConfigFiles
WHERE #presserveSingleQuotes(arguments.criteria)#
/cfquery

   cfreturn readZJF
 /cffunction

 I want to be able to pass in the WHERE statement into it.  So it could
 be: FileName = 'PLATES.zjf' AND FileModificationDate = '09/30/2005 12:34:01
 PM'

Beaware that if this CFC is to be called remotely, you want to tidy it up by 
having explicit name and modification date parameters, to prevent people 
manipulating the SQL.
Even if not, you should do that anyway, so you can make use of cfqueryparam.

-- 
Tom Chiverton



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.


~|
ColdFusion MX7 and Flex 2 
Build sales  marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283998
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question

2007-07-18 Thread Kris Jones
Try preservesinglequotes()?

 What I get back is an error:
 [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near 
 'PLATES.zjf'.

 Then I look at the SQL that was run in debugging.
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE FileName = ''PLATES.zjf'' AND FileModificationDate = ''09/30/2005 
 12:34:01 PM''

 Why did it take my single quotes and add another single quote?  Is it trying 
 to escape the single quote?  How do I keep it from doing this?

~|
CF 8 – Scorpio beta now available, 
easily build great internet experiences – Try it now on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283993
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question

2007-07-18 Thread Charlie Griefer
#preserveSingleQuotes(arguments.criteria)#

On 7/18/07, Chad Gray [EMAIL PROTECTED] wrote:
 I have a CRUD CFC that has this function and I load the CFC into the 
 application scope:

 cffunction name=readZJF access=public returntype=query
 cfargument name=criteria type=string required=yes

 cfquery datasource=dsn name=readZJF
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE #arguments.criteria#
 /cfquery

 cfreturn readZJF
 /cffunction

 I want to be able to pass in the WHERE statement into it.  So it could be:
 FileName = 'PLATES.zjf' AND FileModificationDate = '09/30/2005 12:34:01 PM'

 So I run something like this to call the function:

 cfset DoesFileAlreadyExist = application.ZJF.readZJF(FileName = 
 '#getZJF_files.name#' AND FileModificationDate = 
 '#getZJF_files.dateLastModified#')

 What I get back is an error:
 [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near 
 'PLATES.zjf'.

 Then I look at the SQL that was run in debugging.
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE FileName = ''PLATES.zjf'' AND FileModificationDate = ''09/30/2005 
 12:34:01 PM''

 Why did it take my single quotes and add another single quote?  Is it trying 
 to escape the single quote?  How do I keep it from doing this?


 

~|
ColdFusion 8 beta – Build next generation applications today.
Free beta download on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283995
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: cfc question

2007-07-18 Thread Jim Rising
Have you tried: PreserveSingleQuotes() ?

Jim Rising
Sr. Cold Fusion Developer
ICGLink Inc.
www.icglink.com
 

-Original Message-
From: Chad Gray [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 18, 2007 10:04 AM
To: CF-Talk
Subject: cfc question

I have a CRUD CFC that has this function and I load the CFC into the
application scope:

cffunction name=readZJF access=public returntype=query
cfargument name=criteria type=string required=yes

cfquery datasource=dsn name=readZJF
SELECT *
FROM FlexoDirectConfigFiles
WHERE #arguments.criteria#
/cfquery

cfreturn readZJF  
/cffunction

I want to be able to pass in the WHERE statement into it.  So it could be:
FileName = 'PLATES.zjf' AND FileModificationDate = '09/30/2005 12:34:01 PM'

So I run something like this to call the function:

cfset DoesFileAlreadyExist = application.ZJF.readZJF(FileName =
'#getZJF_files.name#' AND FileModificationDate =
'#getZJF_files.dateLastModified#')

What I get back is an error:
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near
'PLATES.zjf'.

Then I look at the SQL that was run in debugging.
SELECT *
FROM FlexoDirectConfigFiles
WHERE FileName = ''PLATES.zjf'' AND FileModificationDate = ''09/30/2005
12:34:01 PM''

Why did it take my single quotes and add another single quote?  Is it trying
to escape the single quote?  How do I keep it from doing this?




~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283992
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question

2007-07-18 Thread Matt Quackenbush
Chad,

cfquery is indeed escaping your single quotes.  You can get around this in
a couple of ways.  The first is to use preserveSingleQuotes() in your
function, like so:

WHERE #preserveSingleQuotes(arguments.criteria)#

While that is a very easy solution, you will be opening yourself up to all
sorts of security risks.  Therefore, I would strongly urge that you do *not*
use this solution.

Another solution would be to add an argument that would accept an array, or
an array of structs that would hold your criteria.  Here is a quick example
of what I mean.

!--- calling page ---
cfscript
   myArray = arrayNew(1);
   myArray[1] = structNew();
   myArray[1].field = FileName;
   myArray[1].value = PLATES.zjf;
   myArray[1].quote = true;
   myArray[2].field = FileModificationDate;
   myArray[2].value = 09/30/2005 12:34:01 PM;
   myArray[2].quote = true;
/cfscript

!--- function ---
cfargument name=criteria type=array /

cfquery
   WHERE 0 = 0
   cfloop from=1 to=#arrayLen(arguments.criteria)# index=i
  AND #arguments.criteria[i].field# =
 cfif arguments.criteria[i].quote
'#arguments.criteria[i].value#'
 cfelse
#arguments.criteria[i].value#
 /cfif
   /cfloop
/cfquery

Hope that helps.


Matt


I have a CRUD CFC that has this function and I load the CFC into the
 application scope:

 cffunction name=readZJF access=public returntype=query
 cfargument name=criteria type=string required=yes

 cfquery datasource=dsn name=readZJF
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE #arguments.criteria#
 /cfquery

 cfreturn readZJF
 /cffunction

 I want to be able to pass in the WHERE statement into it.  So it could
 be:
 FileName = 'PLATES.zjf' AND FileModificationDate = '09/30/2005 12:34:01
 PM'

 So I run something like this to call the function:

 cfset DoesFileAlreadyExist = application.ZJF.readZJF(FileName =
 '#getZJF_files.name#' AND FileModificationDate =
 '#getZJF_files.dateLastModified#')

 What I get back is an error:
 [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '
 PLATES.zjf'.

 Then I look at the SQL that was run in debugging.
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE FileName = ''PLATES.zjf'' AND FileModificationDate = ''09/30/2005
 12:34:01 PM''

 Why did it take my single quotes and add another single quote?  Is it
 trying to escape the single quote?  How do I keep it from doing this?



~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283997
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: cfc question

2007-07-18 Thread Chad Gray
Thank Matt, Jim and Dan.

I see where you guys are going with this.

As far as security im not sure how using the array is any better.

I suppose once things are broken out using the array I could then validate the 
data coming in with cfqueryparam.

This would keep people from tacking on sub-queries and injecting their own SQL 
statements.

Thanks for the help!
Chad



-Original Message-
From: Matt Quackenbush [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 18, 2007 11:25 AM
To: CF-Talk
Subject: Re: cfc question

Chad,

cfquery is indeed escaping your single quotes.  You can get around this in
a couple of ways.  The first is to use preserveSingleQuotes() in your
function, like so:

WHERE #preserveSingleQuotes(arguments.criteria)#

While that is a very easy solution, you will be opening yourself up to all
sorts of security risks.  Therefore, I would strongly urge that you do *not*
use this solution.

Another solution would be to add an argument that would accept an array, or
an array of structs that would hold your criteria.  Here is a quick example
of what I mean.

!--- calling page ---
cfscript
   myArray = arrayNew(1);
   myArray[1] = structNew();
   myArray[1].field = FileName;
   myArray[1].value = PLATES.zjf;
   myArray[1].quote = true;
   myArray[2].field = FileModificationDate;
   myArray[2].value = 09/30/2005 12:34:01 PM;
   myArray[2].quote = true;
/cfscript

!--- function ---
cfargument name=criteria type=array /

cfquery
   WHERE 0 = 0
   cfloop from=1 to=#arrayLen(arguments.criteria)# index=i
  AND #arguments.criteria[i].field# =
 cfif arguments.criteria[i].quote
'#arguments.criteria[i].value#'
 cfelse
#arguments.criteria[i].value#
 /cfif
   /cfloop
/cfquery

Hope that helps.


Matt


I have a CRUD CFC that has this function and I load the CFC into the
 application scope:

 cffunction name=readZJF access=public returntype=query
 cfargument name=criteria type=string required=yes

 cfquery datasource=dsn name=readZJF
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE #arguments.criteria#
 /cfquery

 cfreturn readZJF
 /cffunction

 I want to be able to pass in the WHERE statement into it.  So it could
 be:
 FileName = 'PLATES.zjf' AND FileModificationDate = '09/30/2005 12:34:01
 PM'

 So I run something like this to call the function:

 cfset DoesFileAlreadyExist = application.ZJF.readZJF(FileName =
 '#getZJF_files.name#' AND FileModificationDate =
 '#getZJF_files.dateLastModified#')

 What I get back is an error:
 [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '
 PLATES.zjf'.

 Then I look at the SQL that was run in debugging.
 SELECT *
 FROM FlexoDirectConfigFiles
 WHERE FileName = ''PLATES.zjf'' AND FileModificationDate = ''09/30/2005
 12:34:01 PM''

 Why did it take my single quotes and add another single quote?  Is it
 trying to escape the single quote?  How do I keep it from doing this?





~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284000
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2007-01-09 Thread Robertson-Ravo, Neil (RX)
Can you add mappings?



This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions. 
Visit our website at http://www.reedexpo.com

-Original Message-
From: Bruce Sorge
To: CF-Talk
Sent: Tue Jan 09 18:39:16 2007
Subject: CFC Question

I have a site on my laptop under Nascar. The CFC directory is Nascar.cfc. On
the live server though the root directory is SynergyDale. So of course my
CFC's cannot be found. Do I need to change the directory name on my laptop
to SynergyDale or is there a way for me to keep my directory the same name
and still reference the CFC. I am going to guess that I have to change my
local directory since the CFC is referenced as NASCAR.CFC.Queries?

-- 

Bruce Sorge




~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266069
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Question

2007-01-09 Thread Bruce Sorge
Nope. Cannot add mappings.

On 1/9/07, Robertson-Ravo, Neil (RX) [EMAIL PROTECTED]
wrote:

 Can you add mappings?



 This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
 Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
 Registered in England, Number 678540.  It contains information which is
 confidential and may also be privileged.  It is for the exclusive use of
 the
 intended recipient(s).  If you are not the intended recipient(s) please
 note
 that any form of distribution, copying or use of this communication or the
 information in it is strictly prohibited and may be unlawful.  If you have
 received this communication in error please return it to the sender or
 call
 our switchboard on +44 (0) 20 89107910.  The opinions expressed within
 this
 communication are not necessarily those expressed by Reed Exhibitions.
 Visit our website at http://www.reedexpo.com

 -Original Message-
 From: Bruce Sorge
 To: CF-Talk
 Sent: Tue Jan 09 18:39:16 2007
 Subject: CFC Question

 I have a site on my laptop under Nascar. The CFC directory is Nascar.cfc.
 On
 the live server though the root directory is SynergyDale. So of course my
 CFC's cannot be found. Do I need to change the directory name on my laptop
 to SynergyDale or is there a way for me to keep my directory the same name
 and still reference the CFC. I am going to guess that I have to change my
 local directory since the CFC is referenced as NASCAR.CFC.Queries?

 --

 Bruce Sorge




 

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266070
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2007-01-09 Thread Jon Clausen
Bruce,

Create a mapping in the CF Admin on your local machine for / 
SynergyDale pointing to the /nascar/ directory.

Then use SynergyDale.cfc as your cfc object reference.

You can also do the reverse on the remote server if you wish.

HTH,

Jon

On Jan 9, 2007, at 1:39 PM, Bruce Sorge wrote:

 I have a site on my laptop under Nascar. The CFC directory is  
 Nascar.cfc. On
 the live server though the root directory is SynergyDale. So of  
 course my
 CFC's cannot be found. Do I need to change the directory name on my  
 laptop
 to SynergyDale or is there a way for me to keep my directory the  
 same name
 and still reference the CFC. I am going to guess that I have to  
 change my
 local directory since the CFC is referenced as NASCAR.CFC.Queries?

 -- 
 Bruce Sorge


 

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266071
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC Question

2007-01-09 Thread Dan Vega
Straight from livedocs
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/buildi12.htm
Specifying the CFC location

When you instantiate or invoke a component, you can specify the component
name only, or you can specify a *qualified* path. To specify a qualified
path, separate the directory names with periods, not slashes; for example,
myApp.cfcs.myComponent specifies the component defined in
myApp\cfcs\myComponent.cfc.

ColdFusion uses the following rules to find the specified CFC.

   - If you use a
cfinvokehttp://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p67.htm#wp2650065or
   
cfobjecthttp://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-pb5.htm#wp1810139tag,
or the
   
CreateObjecthttp://livedocs.macromedia.com/coldfusion/6.1/htmldocs/functi42.htm#wp1102241function
to access the CFC from a CFML page, ColdFusion searches directories
   in the following order:
  1. Local directory of the calling CFML page
  2. Directories specified on the ColdFusion Mappings page of the
  ColdFusion MX Administrator
  3. Web root
  4. Directories specified on Custom Tag Paths page of the
  Administrator

   If you specify only a component name, ColdFusion searches each of
   these directories, in turn, for the component.

   *Note: *If you use only the component name to specify the CFC,
   ColdFusion does not search the directories specified in the Administrator on
   the ColdFusion Mappings page. If you specify a qualified path that starts
   with a mapped directory name, ColdFusion does find the component.

   If you specify a qualified path, such as myApp.cfcs.myComponent,
   ColdFusion looks for a directory matching the first element of the path in
   each of these directories (in this example, myApp). If it finds a matching
   directory, it then looks for a file in the specified path beneath that
   directory, such as myApp\cfcs\myComponent.cfc relative to each of these
   directories.

   *Note: *If ColdFusion finds a directory that matches the first path
   element, but does not find a CFC under that directory, ColdFusion returns a
   not found error and does *not* search for another directory.
   - If you invoke a CFC method remotely, using a specific URL, form
   field, Flash Remoting MX, or a web service invocation, ColdFusion looks in
   the specified path relative to the web root. For form fields and URLs
   specified directly on local web pages, ColdFusion also searches relative to
   the page directory.

*Note: *On UNIX and Linux systems, ColdFusion MX attempts to match a CFC
name or Custom tag name with a filename as follows: First, it attempts to
find a file with the name that is all lowercase. If it fails, it then tries
to find a file whose case matches the CFML case. For example, if you specify
cfobject name=myObject Component=myComponent, ColdFusion first looks
for mycomponent.cfc and, if it doesn't find it, ColdFusion looks for
myComponent.cfc.




-- 
Thank You
Dan Vega
[EMAIL PROTECTED]
http://www.danvega.org


~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266072
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC Question

2007-01-09 Thread Bruce Sorge
I figured it out. Just droped the SynergyDale and use CFC.Queries.

On 1/9/07, Jon Clausen [EMAIL PROTECTED] wrote:

 Bruce,

 Create a mapping in the CF Admin on your local machine for /
 SynergyDale pointing to the /nascar/ directory.

 Then use SynergyDale.cfc as your cfc object reference.

 You can also do the reverse on the remote server if you wish.

 HTH,

 Jon

 On Jan 9, 2007, at 1:39 PM, Bruce Sorge wrote:

  I have a site on my laptop under Nascar. The CFC directory is
  Nascar.cfc. On
  the live server though the root directory is SynergyDale. So of
  course my
  CFC's cannot be found. Do I need to change the directory name on my
  laptop
  to SynergyDale or is there a way for me to keep my directory the
  same name
  and still reference the CFC. I am going to guess that I have to
  change my
  local directory since the CFC is referenced as NASCAR.CFC.Queries?
 
  --
  Bruce Sorge
 
 
 

 

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266073
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CFC Question

2007-01-09 Thread Ryan, Terrence
My particular way around this is to set a CFC path variable in the application 
scope.  So I call CFC's like this:


cfset application.CFCpath = cfc /
Or 
cfset application.CFCpath = synergydale.cfc /

cfobject component=#application.cfcPath#.nascar name=nascarObj

Yeah it's extra typing, but is a lot easier to maintain.  If that option is 
palatable to you. 


Terrence Ryan
Senior Systems Programmer
Wharton Computing and Information Technology   
E-mail:     [EMAIL PROTECTED]


-Original Message-
From: Bruce Sorge [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 09, 2007 1:39 PM
To: CF-Talk
Subject: CFC Question

I have a site on my laptop under Nascar. The CFC directory is Nascar.cfc. On
the live server though the root directory is SynergyDale. So of course my
CFC's cannot be found. Do I need to change the directory name on my laptop
to SynergyDale or is there a way for me to keep my directory the same name
and still reference the CFC. I am going to guess that I have to change my
local directory since the CFC is referenced as NASCAR.CFC.Queries?

-- 
Bruce Sorge

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266074
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-10-04 Thread Robertson-Ravo, Neil (RX)
And the rest of them :-)





This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions. 
Visit our website at http://www.reedexpo.com

-Original Message-
From: Aaron Rouse
To: CF-Talk
Sent: Wed Oct 04 05:33:10 2006
Subject: Re: CFC question

If this change is made just make sure and var myReturnVar first.

On 10/3/06, Alan Rother [EMAIL PROTECTED] wrote:

 Seems like this is a way to do it. I would suggest, without tetsing it...
 that instead of doing this

 cfif getTestCount() lt 2
   cfreturn TRUE /

 cfelse
   cfreturn FALSE /
 /cfif

 Do this...

 cfif getTestCount() lt 2
   cfset myReturnVar = TRUE /

 cfelse
   cfset myReturnVar = FALSE /
 /cfif

 cfreturn myReturnVar/


 Are you getting an error or anything, or was this more of theorhetical
 question?





~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255346
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-10-04 Thread Mike H
If this change is made just make sure and var myReturnVar first.

On 10/3/06, Alan Rother [EMAIL PROTECTED] wrote:

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255417
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-10-04 Thread Mike H
Thanks, All. I wanted to make sure I was on the right track...

Seems like this is a way to do it. I would suggest, without tetsing it...
that instead of doing this

cfif getTestCount() lt 2
  cfreturn TRUE /

 cfelse
  cfreturn FALSE /
 /cfif

Do this...

cfif getTestCount() lt 2
  cfset myReturnVar = TRUE /

 cfelse
  cfset myReturnVar = FALSE /
 /cfif

cfreturn myReturnVar/


Are you getting an error or anything, or was this more of theorhetical
question?
On 10/3/06, Michael Hughes [EMAIL PROTECTED] wrote:


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255418
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC question

2006-10-03 Thread Alan Rother
Seems like this is a way to do it. I would suggest, without tetsing it...
that instead of doing this

cfif getTestCount() lt 2
  cfreturn TRUE /

 cfelse
  cfreturn FALSE /
 /cfif

Do this...

cfif getTestCount() lt 2
  cfset myReturnVar = TRUE /

 cfelse
  cfset myReturnVar = FALSE /
 /cfif

cfreturn myReturnVar/


Are you getting an error or anything, or was this more of theorhetical
question?
On 10/3/06, Michael Hughes [EMAIL PROTECTED] wrote:

 Hey folks - I'm brand new to Cold Fusion and inherited an application from
 an advanced developer. I'm trying to change a function in a cfc to allow an
 online test to be taken multiple times based on the user's role and how many
 times they've already taken the test:

 cffunction name=getTestCount
 returntype=numeric
cfquery name=getMyTests datasource=#request.maindsn#
 dbtype=ODBC 
SELECT count(test_id) total_tests
FROM user_tests
WHERE user_id = '#THIS.userId#'
/cfquery

cfreturn getMyTests.total_tests /

/cffunction

 cffunction name=canTakeTest
returntype=boolean

 cfif getTestCount() lt 2
   cfreturn TRUE /

 cfelse
   cfreturn FALSE /
 /cfif

 Couldn't I conceivably add a function that would query the database and
 return the role for the specific user id, assign that role as a variable,
 and rewrite the getTestCount() function so that if the test count is   2
 and the role = a certain value, then the user can take the test multiple
 times?  Thanks for your help! ~M




 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255319
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-10-03 Thread Aaron Rouse
Yes, you could do that.

On 10/3/06, Michael Hughes [EMAIL PROTECTED] wrote:



 Couldn't I conceivably add a function that would query the database and
 return the role for the specific user id, assign that role as a variable,
 and rewrite the getTestCount() function so that if the test count is   2
 and the role = a certain value, then the user can take the test multiple
 times?  Thanks for your help! ~M




 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255334
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-10-03 Thread Aaron Rouse
If this change is made just make sure and var myReturnVar first.

On 10/3/06, Alan Rother [EMAIL PROTECTED] wrote:

 Seems like this is a way to do it. I would suggest, without tetsing it...
 that instead of doing this

 cfif getTestCount() lt 2
   cfreturn TRUE /

 cfelse
   cfreturn FALSE /
 /cfif

 Do this...

 cfif getTestCount() lt 2
   cfset myReturnVar = TRUE /

 cfelse
   cfset myReturnVar = FALSE /
 /cfif

 cfreturn myReturnVar/


 Are you getting an error or anything, or was this more of theorhetical
 question?



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255335
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CFC question

2006-09-13 Thread Adrian Lynch
So you have the original value maybe?

Ade

-Original Message-
From: Victor Moore [mailto:[EMAIL PROTECTED]
Sent: 13 September 2006 15:54
To: CF-Talk
Subject: CFC question


Hi,

I have seen in a number of examples the following:

cfset variables.myVar = arguments.someArg /
any particular reason/advantage why the arguments are assigned to a local
variable inside a cfc function instead of using it directly?

Thanks
Victor

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252985
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-09-13 Thread Dave Carabetta
On 9/13/06, Victor Moore [EMAIL PROTECTED] wrote:
 Hi,

 I have seen in a number of examples the following:

 cfset variables.myVar = arguments.someArg /
 any particular reason/advantage why the arguments are assigned to a local
 variable inside a cfc function instead of using it directly?


In that example, variables.myVar is not *local*. It's *global* to the
CFC such that *any* method in that CFC has access to its value. Now,
if the code said:

cfset var myVar = arguments.someArg /

then that might just be for creating a short-hand reference to the value.

In CFCs, the variables scope is global, meaning that any method of
the CFC (and any sub-classes, by the way), has access to its value. If
you want a truly local variable for a method, use the var setting,
as noted above.

Regards,
Dave.

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252986
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CFC question

2006-09-13 Thread COLLIE David
 I have seen in a number of examples the following:
 
 cfset variables.myVar = arguments.someArg / any particular 
 reason/advantage why the arguments are assigned to a local 
 variable inside a cfc function instead of using it directly?


To make it persistant in the lifetime of the CFC

See Ray Camden's site for a explaniation of the scopes within a CFC
which says it way better than I could.

http://ray.camdenfamily.com/downloads/cfcscopes.pdf


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252988
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CFC question

2006-09-13 Thread Andy Matthews
Most likely so that if someone changes the argument name you only have to
change it once, instead of each time that it appears inside of the function.

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-

-Original Message-
From: Victor Moore [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 13, 2006 9:54 AM
To: CF-Talk
Subject: CFC question


Hi,

I have seen in a number of examples the following:

cfset variables.myVar = arguments.someArg /
any particular reason/advantage why the arguments are assigned to a local
variable inside a cfc function instead of using it directly?

Thanks
Victor




~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252983
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC question

2006-09-13 Thread Michael Dinowitz
Syntax like that is usually used within an init() method to set a passed 
variable to the CFCs global variable scope to be used by other methods. When 
a CFC is cached or called outside of a one shot invoke, this is a must to 
prevent having to pass the variable in again and again.
For example, someone would do the following:
CFSET objectreference=Createobject('component', 
'testobject').init('datasourcename')
CFSET objectreference.getuser(userid)

In the second line, there is no need to send in the datasource name as it 
was sent in when the object was created.


 Hi,

 I have seen in a number of examples the following:

 cfset variables.myVar = arguments.someArg /
 any particular reason/advantage why the arguments are assigned to a local
 variable inside a cfc function instead of using it directly?

 Thanks
 Victor


 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252987
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CFC question

2006-09-13 Thread Ryan, Terrence
Typically if you are doing manipulation of the value, you don't want to alter 
the input value, but rather a copy of it. 

Cfset var firstName = Trim(arguments.firstname) /
Vs 
Cfset arguments.firstName = Trim(arguments.firstname) /

If you're not manipulating it further, then it might be a bit redundant at 
first:

Cfset var localfirstName = arguments.firstname /
 
But by writing it this way, you make sure that if further down the road, if you 
find out that whitespace is being added to the end of certain firstnames, and 
you want to add the trim operation, you don't have to add it for every 
reference to arguments.firstname.  

So it's a best practice in that it allows you for more maintainable code. 


Terrence Ryan
Senior Systems Programmer
Wharton Computing and Information Technology
E-mail:     [EMAIL PROTECTED]
 

-Original Message-
From: Victor Moore [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 10:54 AM
To: CF-Talk
Subject: CFC question

Hi,

I have seen in a number of examples the following:

cfset variables.myVar = arguments.someArg / any particular reason/advantage 
why the arguments are assigned to a local variable inside a cfc function 
instead of using it directly?

Thanks
Victor




~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252990
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-09-13 Thread Jake Churchill
This just came up on something for me this morning and I read that by 
doing this, it allows your .init() function to access the variables.

Ryan, Terrence wrote:
 Typically if you are doing manipulation of the value, you don't want to alter 
 the input value, but rather a copy of it. 

 Cfset var firstName = Trim(arguments.firstname) /
 Vs 
 Cfset arguments.firstName = Trim(arguments.firstname) /

 If you're not manipulating it further, then it might be a bit redundant at 
 first:

 Cfset var localfirstName = arguments.firstname /
  
 But by writing it this way, you make sure that if further down the road, if 
 you find out that whitespace is being added to the end of certain firstnames, 
 and you want to add the trim operation, you don't have to add it for every 
 reference to arguments.firstname.  

 So it's a best practice in that it allows you for more maintainable code. 


 Terrence Ryan
 Senior Systems Programmer
 Wharton Computing and Information Technology
 E-mail: [EMAIL PROTECTED]
  

 -Original Message-
 From: Victor Moore [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, September 13, 2006 10:54 AM
 To: CF-Talk
 Subject: CFC question

 Hi,

 I have seen in a number of examples the following:

 cfset variables.myVar = arguments.someArg / any particular reason/advantage 
 why the arguments are assigned to a local variable inside a cfc function 
 instead of using it directly?

 Thanks
 Victor




 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252992
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC question

2006-09-13 Thread Victor Moore
Good points and nice doc by Ray. I didn't know about the variables scope
being available to the whole cfc.

Thanks
Victor


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252993
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFC question

2006-09-13 Thread Cutter (CFRelated)
The variables scope, when used within a CFC, is a protected private 
scope (only accessible from within the CFC). Within the head of your 
object (after the cfcomponent tag, but prior to any functions) you may 
have a block like this:

cfscript
variables.instance = structnew();
variables.instance.firstname = ;
variables.instance.lastname = ;
variables.instance.age = 0;
/cfscript

Then you might have an init method like this:

cffunction name=init access=public output=false 
returntype=person hint=This initializes your person object
cfreturn this
/cffunction

You would then get or set the properties of your object using getter and 
setter methods, which can access the private variables scope:

cffunction name=setFirstName access=public output=false 
returntype=void hint=Sets the firstname property of this instance
cfargument name=firstname type=string required=true 
hint=firstname to set in this instance of person
cfset variables.instance.firstname = arguments.firstname
/cffunction

cffunction name=getFirstName access=public output=false 
returntype=string hint=Returns the firstname of this person instance
cfreturn variables.instance.firstname
/cffunction

So, within your calling template you might have:

cfset variables.personObj = createobject(component,person).init()

After which, the following attempt to access it's properties would 
fail/error:

#variables.personObj.firstname#

But using this would give you access:

#variables.personObj.getFirstName()#

Hope this helps:)

Cutter
_
http://blog.cutterscrossing.com

Victor Moore wrote:
 Hi,
 
 I have seen in a number of examples the following:
 
 cfset variables.myVar = arguments.someArg /
 any particular reason/advantage why the arguments are assigned to a local
 variable inside a cfc function instead of using it directly?
 
 Thanks
 Victor
 
 
 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253007
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFC question

2006-09-13 Thread Teddy Payne
Another reason to use the variables scope outside of a method like init()
would be when you extend a CFC from another CFC.

The variables defined in the variables scope will act like a psuedo
constructor if you are not calling that CFC via a cfinvoke, cfobject ...etc.

It provides a little flexibility on how the CFC can be consumed.

Teddy

On 9/13/06, Cutter (CFRelated) [EMAIL PROTECTED] wrote:

 The variables scope, when used within a CFC, is a protected private
 scope (only accessible from within the CFC). Within the head of your
 object (after the cfcomponent tag, but prior to any functions) you may
 have a block like this:

 cfscript
 variables.instance = structnew();
 variables.instance.firstname = ;
 variables.instance.lastname = ;
 variables.instance.age = 0;
 /cfscript

 Then you might have an init method like this:

 cffunction name=init access=public output=false
 returntype=person hint=This initializes your person object
 cfreturn this
 /cffunction

 You would then get or set the properties of your object using getter and
 setter methods, which can access the private variables scope:

 cffunction name=setFirstName access=public output=false
 returntype=void hint=Sets the firstname property of this instance
 cfargument name=firstname type=string required=true
 hint=firstname to set in this instance of person
 cfset variables.instance.firstname = arguments.firstname
 /cffunction

 cffunction name=getFirstName access=public output=false
 returntype=string hint=Returns the firstname of this person instance
 cfreturn variables.instance.firstname
 /cffunction

 So, within your calling template you might have:

 cfset variables.personObj = createobject(component,person).init()

 After which, the following attempt to access it's properties would
 fail/error:

 #variables.personObj.firstname#

 But using this would give you access:

 #variables.personObj.getFirstName()#

 Hope this helps:)

 Cutter
 _
 http://blog.cutterscrossing.com

 Victor Moore wrote:
  Hi,
 
  I have seen in a number of examples the following:
 
  cfset variables.myVar = arguments.someArg /
  any particular reason/advantage why the arguments are assigned to a
 local
  variable inside a cfc function instead of using it directly?
 
  Thanks
  Victor
 
 
 

 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253038
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfc question

2004-09-10 Thread Tony Weeg
and im trying to do the qofq within the cfc, and the result is simply
an digit that i set to a session var, just to get it out...for this
test...

tw

On Fri, 10 Sep 2004 14:11:34 -0400, Tony Weeg [EMAIL PROTECTED] wrote:
 hi there.
 
 i have this code @ the top of my cfc
 where i initialize the variable to be used in the cfc
 
 cfset var get = 0
 
 and then later on down i have a query that is of the same name
 that is also the query i return back to the calling cfm page.
 
 problem...
 i cannot do a query of queries on the query called get,
 
 i get this error:
 
 Diagnostics:
 Error Executing Database Query.
 Query Of Queries syntax error.
 Encountered get at line 0, column 0.
 The error occurred on line 430.
 
 ? any ideas?
 
 --
 tony
 
 Tony Weeg
 
 macromedia certified cold fusion developer
 email: tonyweeg [at] gmail [dot] com
 blog: http://www.revolutionwebdesign.com/blog/
 cool tool: http://www.antiwrap.com
 

-- 
tony

Tony Weeg

macromedia certified cold fusion developer
email: tonyweeg [at] gmail [dot] com
blog: http://www.revolutionwebdesign.com/blog/
cool tool: http://www.antiwrap.com
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: cfc question

2004-09-10 Thread Jim Davis
Some ideas:

The var keyword really has no meaning outside of a method. I'm surprised
that it's actually not throwing an error on that - but it could be,
indirectly, a cause.

The variable name get may be legal in CF, but seems suspicious - I wonder
if you're hitting so weird incompatibility with it.Have you tried another
variable name?

When you set a variable outside of a method it's assigned to the variables
scope - you might try specifically scoping the reference later (use
variables.get rather than just get).

Jim Davis
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: CFC question

2003-10-14 Thread Raymond Camden
When you pass an argument to a CFC method, it isn't available in the
This scope, it's available in the Arguments scope:

cffunction name=whichMap returnType=numeric
	cfargument name=theQuery type=query required=true

	cfreturn arguments.theQuery.recordCount
/cffunction

You can also leave the arguments. off as long as you have the
cfargument tag, but I recommend keeping it in.


 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC question

2003-10-14 Thread John McCosker
Thought I was missing something,
Thanks Raymond.

-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: 14 October 2003 16:18
To: CF-Talk
Subject: RE: CFC question

When you pass an argument to a CFC method, it isn't available in the
This scope, it's available in the Arguments scope:

cffunction name=whichMap returnType=numeric
cfargument name=theQuery type=query required=true

cfreturn arguments.theQuery.recordCount
/cffunction

You can also leave the arguments. off as long as you have the
cfargument tag, but I recommend keeping it in.

_


 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC question

2003-10-14 Thread Raymond Camden
Just in case it's not clear, the same would also apply to a UDF written
using cffunciton as well.

Also, don't forget that when you pass a query (or a struct or another
cfc) to a method, you pass it be reference, not by value. So if the
method changes the query, you are changing your original query as well.
If this bug you, just do

cfset foo = blah.method(duplicate(theQuery))


 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC Question

2003-10-01 Thread Aunger, Mitch
With a CFC, you only 'return' once... you don't return within a loop... (in your case you are only getting the last item)
 
what you want to do is build a structure of names and then outside the loop, return the structure.
 
make sense?
 
Mitch
Shameless plug for my wife's business:
http://www.mygccandle.com/showmescents

-Original Message-
From: Ben Densmore [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 01, 2003 3:19 PM
To: CF-Talk
Subject: CFC Question


I'm just starting to play with CFC's to get familiar with them and was
trying to write some play code to see if it would work. I got it to work
but it only displays 1 record out of a loop I'm doing. How would I go
about getting all records to display? Here is the code I'm playing with:

CFC:
cfcomponent displayName=showArray
cffunction access=public name=categories output=false
returntype=string
cfscript
value = listToArray('Amplifiers,Mixers,Modulators,Switches');
session.cart = structNew();
structInsert(session.cart, Product Category, #value#);

/cfscript

cfloop collection=#session.cart# item=i
cfloop from=1 to=#Arraylen(value)# index=j
cfset names = #i# #j#: #session.cart[i][j]#
cfreturnnames /

/cfloop
/cfloop

/cffunction
/cfcomponent

cfm File:

cfinvoke 
component=category 
method=categories
returnvariable=var
/cfinvoke

cfoutput#var#/cfoutputbr

so instead of showing 4 values I get Product Name 1: Amplifiers, how do
I get all 4 to display as they would if I had all my code inline in a
cfm page?

Thanks,
Ben 
_

[Todays
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC Question

2003-10-01 Thread Ben Densmore
I don't follow completely. If I seta variable inside the loop to
contain the structure then try to return that I get the same result.

 

Ben

 

-Original Message-
From: Aunger, Mitch [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 01, 2003 4:36 PM
To: CF-Talk
Subject: RE: CFC Question

 

With a CFC, you only 'return' once... you don't return within a loop...
(in your case you are only getting the last item)

what you want to do is build a structure of names and then outside the
loop, return the structure.

make sense?

Mitch
Shameless plug for my wife's business:
http://www.mygccandle.com/showmescents

-Original Message-
From: Ben Densmore [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 01, 2003 3:19 PM
To: CF-Talk
Subject: CFC Question


I'm just starting to play with CFC's to get familiar with them and was
trying to write some play code to see if it would work. I got it to work
but it only displays 1 record out of a loop I'm doing. How would I go
about getting all records to display? Here is the code I'm playing with:

CFC:
cfcomponent displayName=showArray
cffunction access=public name=categories output=false
returntype=string
cfscript
value = listToArray('Amplifiers,Mixers,Modulators,Switches');
session.cart = structNew();
structInsert(session.cart, Product Category, #value#);

/cfscript

cfloop collection=#session.cart# item=i
cfloop from=1 to=#Arraylen(value)# index=j
cfset names = #i# #j#: #session.cart[i][j]#
cfreturnnames /

/cfloop
/cfloop

/cffunction
/cfcomponent

cfm File:

cfinvoke 
component=category 
method=categories
returnvariable=var
/cfinvoke

cfoutput#var#/cfoutputbr

so instead of showing 4 values I get Product Name 1: Amplifiers, how do
I get all 4 to display as they would if I had all my code inline in a
cfm page?

Thanks,
Ben 
_

[Todays

_


 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC Question

2003-10-01 Thread Andy Ousterhout
That's because The return command sends you back to the calling program.Why
not just return session.cart at the end of your script and deleted the
imbedded loops.

Andy
-Original Message-
From: Ben Densmore [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 3:19 PM
To: CF-Talk
Subject: CFC Question


I'm just starting to play with CFC's to get familiar with them and was
trying to write some play code to see if it would work. I got it to work
but it only displays 1 record out of a loop I'm doing. How would I go
about getting all records to display? Here is the code I'm playing with:

CFC:
cfcomponent displayName=showArray
cffunction access=public name=categories output=false
returntype=string
cfscript
 value = listToArray('Amplifiers,Mixers,Modulators,Switches');
 session.cart = structNew();
 structInsert(session.cart, Product Category, #value#);

/cfscript

cfloop collection=#session.cart# item=i
 cfloop from=1 to=#Arraylen(value)# index=j
cfset names = #i# #j#: #session.cart[i][j]#
cfreturnnames /

 /cfloop
/cfloop

/cffunction
/cfcomponent

cfm File:

cfinvoke
component=category
method=categories
returnvariable=var
/cfinvoke

cfoutput#var#/cfoutputbr

so instead of showing 4 values I get Product Name 1: Amplifiers, how do
I get all 4 to display as they would if I had all my code inline in a
cfm page?

Thanks,
Ben

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC Question

2003-10-01 Thread Andy Ousterhout
Yes.But you also exited the program at the end of the first loop.
-Original Message-
From: Ben Densmore [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 3:42 PM
To: CF-Talk
Subject: RE: CFC Question


I don't follow completely. If I seta variable inside the loop to
contain the structure then try to return that I get the same result.



Ben



-Original Message-
From: Aunger, Mitch [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 4:36 PM
To: CF-Talk
Subject: RE: CFC Question



With a CFC, you only 'return' once... you don't return within a loop...
(in your case you are only getting the last item)

what you want to do is build a structure of names and then outside the
loop, return the structure.

make sense?

Mitch
Shameless plug for my wife's business:
http://www.mygccandle.com/showmescents

-Original Message-
From: Ben Densmore [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 3:19 PM
To: CF-Talk
Subject: CFC Question


I'm just starting to play with CFC's to get familiar with them and was
trying to write some play code to see if it would work. I got it to work
but it only displays 1 record out of a loop I'm doing. How would I go
about getting all records to display? Here is the code I'm playing with:

CFC:
cfcomponent displayName=showArray
cffunction access=public name=categories output=false
returntype=string
cfscript
 value = listToArray('Amplifiers,Mixers,Modulators,Switches');
 session.cart = structNew();
 structInsert(session.cart, Product Category, #value#);

/cfscript

cfloop collection=#session.cart# item=i
 cfloop from=1 to=#Arraylen(value)# index=j
cfset names = #i# #j#: #session.cart[i][j]#
cfreturnnames /

 /cfloop
/cfloop

/cffunction
/cfcomponent

cfm File:

cfinvoke
component=category
method=categories
returnvariable=var
/cfinvoke

cfoutput#var#/cfoutputbr

so instead of showing 4 values I get Product Name 1: Amplifiers, how do
I get all 4 to display as they would if I had all my code inline in a
cfm page?

Thanks,
Ben
 _

[Todays

 _



 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC Question

2003-10-01 Thread Barney Boisvert
you can only return a single value from a method in a CFC.IF you need to
return multiple values, then you have to package them into a complex value
(a struct) and then return the struct.So rather than this:

cfloop from=1 to=3 index=i
cfset names = session.myArray[i] /
cfreturn names /
/cfloop

you'd do something like this (this is foolish, because you could just return
the array, but you see the point):

cfset names = structNew() /
cfloop from=1 to=3 index=i
cfset names[i] = session.myArray[i] /
/cfloop
cfreturn names /

barneyb
-Original Message-
From: Ben Densmore [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 1:42 PM
To: CF-Talk
Subject: RE: CFC Question


I don't follow completely. If I seta variable inside the loop to
contain the structure then try to return that I get the same result.

Ben

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CFC question

2003-07-14 Thread Mike Townend
Change the line so it reads

CFSET goo = foo(arg)

And it shoud then run the function

HTH



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 14, 2003 15:34
To: CF-Talk
Subject: CFC question


Ok, I built a CFC replete with some methods.  One method, call it foo, is to
be called only from WITHIN the CFC.  Now, I call the method like this cfset
goo = this.foo(arg)

If the method is declared with a specifier of public or package, all is
good.  But if I declare it as private, it bombs out with an error about not
finding the method.  I thought a private method is available to the
component it lives in?  So whats the deal?

Cheers!

--
Douglas Knudsen
ACI Rapid Response Team
678-351-6063
To fear love is to fear life, and those who fear life are already three
parts dead. Bertrand Russell 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC question

2003-07-14 Thread Raymond Camden
When you say, x = this.foo, it acts as an outside call. Just do

cfset goo = foo(arg)


===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email: [EMAIL PROTECTED]
Blog : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 14, 2003 8:34 AM
 To: CF-Talk
 Subject: CFC question
 
 
 Ok, I built a CFC replete with some methods.  One method, 
 call it foo, is to be called only from WITHIN the CFC.  Now, 
 I call the method like this cfset goo = this.foo(arg)
 
 If the method is declared with a specifier of public or 
 package, all is good.  But if I declare it as private, it 
 bombs out with an error about not finding the method.  I 
 thought a private method is available to the component it 
 lives in?  So whats the deal?
 
 Cheers!
 
 --
 Douglas Knudsen
 ACI Rapid Response Team
 678-351-6063
 To fear love is to fear life, and those who fear life are 
 already three parts dead. Bertrand Russell 
 
 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC question

2003-07-14 Thread Douglas.Knudsen
ah!  danke!  That did it.

Doug

-Original Message-
From: Mike Townend [mailto:[EMAIL PROTECTED]
Sent: Monday, July 14, 2003 10:39 AM
To: CF-Talk
Subject: RE: CFC question


Change the line so it reads

CFSET goo = foo(arg)

And it shoud then run the function

HTH



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 14, 2003 15:34
To: CF-Talk
Subject: CFC question


Ok, I built a CFC replete with some methods.  One method, call 
it foo, is to
be called only from WITHIN the CFC.  Now, I call the method 
like this cfset
goo = this.foo(arg)

If the method is declared with a specifier of public or package, all is
good.  But if I declare it as private, it bombs out with an 
error about not
finding the method.  I thought a private method is available to the
component it lives in?  So whats the deal?

Cheers!

--
Douglas Knudsen
ACI Rapid Response Team
678-351-6063
To fear love is to fear life, and those who fear life are 
already three
parts dead. Bertrand Russell 



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: CFC question

2003-07-14 Thread Kwang Suh
Yikes.  What was the reasoning behind this?

- Original Message - 
From: Raymond Camden [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Monday, July 14, 2003 8:40 AM
Subject: RE: CFC question


 When you say, x = this.foo, it acts as an outside call. Just do

 cfset goo = foo(arg)

 
 ===
 Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
 (www.mindseye.com)
 Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

 Email: [EMAIL PROTECTED]
 Blog : www.camdenfamily.com/morpheus/blog
 Yahoo IM : morpheus

 My ally is the Force, and a powerful ally it is. - Yoda

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Monday, July 14, 2003 8:34 AM
  To: CF-Talk
  Subject: CFC question
 
 
  Ok, I built a CFC replete with some methods.  One method,
  call it foo, is to be called only from WITHIN the CFC.  Now,
  I call the method like this cfset goo = this.foo(arg)
 
  If the method is declared with a specifier of public or
  package, all is good.  But if I declare it as private, it
  bombs out with an error about not finding the method.  I
  thought a private method is available to the component it
  lives in?  So whats the deal?
 
  Cheers!
 
  --
  Douglas Knudsen
  ACI Rapid Response Team
  678-351-6063
  To fear love is to fear life, and those who fear life are
  already three parts dead. Bertrand Russell
 
 
 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC question

2003-05-31 Thread webguy
Use the metadata - chapter 11 of the cfmx docs section 4

WG

-Original Message-
From: Michael Tangorre [mailto:[EMAIL PROTECTED]
Sent: 30 May 2003 18:15
To: CF-Talk
Subject: CFC question


Is there a way to display all the functions within a cfc in one line or
using one tag...
I have 4 or 5 CFCs and want to get a listing of all the functions within
them to print out.

Thanks,

Michael Tangorre

[EMAIL PROTECTED]
www.realmagnet.com
work - 202-244-7845
fax - 202-244-7926
cell - 607-426-9277


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC question

2003-05-31 Thread Andy Ousterhout
I've used cfdump var=#this.cfc# to list all of the methods.

-Original Message-
From: Michael Tangorre [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 12:15 PM
To: CF-Talk
Subject: CFC question


Is there a way to display all the functions within a cfc in one line or
using one tag...
I have 4 or 5 CFCs and want to get a listing of all the functions within
them to print out.

Thanks,

Michael Tangorre

[EMAIL PROTECTED]
www.realmagnet.com
work - 202-244-7845
fax - 202-244-7926
cell - 607-426-9277


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: CFC question

2003-05-31 Thread Michael Tangorre
Nice! Thanks.. that is cool and exactly what I was looking for.

Mike


- Original Message - 
From: webguy [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Friday, May 30, 2003 1:57 PM
Subject: RE: CFC question


 Use the metadata - chapter 11 of the cfmx docs section 4

 WG

 -Original Message-
 From: Michael Tangorre [mailto:[EMAIL PROTECTED]
 Sent: 30 May 2003 18:15
 To: CF-Talk
 Subject: CFC question


 Is there a way to display all the functions within a cfc in one line or
 using one tag...
 I have 4 or 5 CFCs and want to get a listing of all the functions within
 them to print out.

 Thanks,

 Michael Tangorre
 
 [EMAIL PROTECTED]
 www.realmagnet.com
 work - 202-244-7845
 fax - 202-244-7926
 cell - 607-426-9277
 

 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: CFC Question

2003-01-31 Thread Andy Ousterhout
Ok, so in your example, Invoice has-a Ordering Person, how do I set
FirstName?

Invoice.OrderingPerson.setFirst(Sean); ?

Will this automatically go to Person.cfc and execute setFirst method?

Andy

-Original Message-
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 12:39 AM
To: CF-Talk
Subject: Re: CFC Question


On Thursday, Jan 30, 2003, at 21:58 US/Pacific, Andy Ousterhout wrote:
 OK, I am hooked after only a few hours on CFC's.  This is so much
 easier to
 code that what I was trying to do with modules  includes in 5.0

:)

 For the sake of discussion, lets also say I have another component
 called
 Invoice that needs two Person objects, one for Ordering Person and
 another
 for Ship To person.  I can't just use extends because that creates a
 single
 person instance.   How do I code this?

extends represents an is-a relationship:

car is-a vehicle

so

!--- car.cfc ---
cfcomponent extends=vehicle
...
/cfcomponent

is a reasonable model.

has-a is modeled by 'containment' - having data members:

Invoice has-a Ordering Person
Invoice has-a ShipTo Person

so

!--- invoice.cfc ---
cfcomponent
cffunction name=create
cfargument name=shipto type=person
cfargument name=orderer type=person
cfset this.shipto = arguments.shipto
cfset this.orderer = arguments.orderer
/cffunction
/cfcomponent

Hope that helps?

Sean A Corfield -- http://www.corfield.org/blog/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: CFC Question - Found Answer

2003-01-31 Thread Andy Ousterhout
http://www.macromedia.com/desdev/mx/coldfusion/articles/supsub.html

-Original Message-
From: Andy Ousterhout [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 7:53 AM
To: CF-Talk
Subject: RE: CFC Question


Ok, so in your example, Invoice has-a Ordering Person, how do I set
FirstName?

Invoice.OrderingPerson.setFirst(Sean); ?

Will this automatically go to Person.cfc and execute setFirst method?

Andy

-Original Message-
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 12:39 AM
To: CF-Talk
Subject: Re: CFC Question


On Thursday, Jan 30, 2003, at 21:58 US/Pacific, Andy Ousterhout wrote:
 OK, I am hooked after only a few hours on CFC's.  This is so much
 easier to
 code that what I was trying to do with modules  includes in 5.0

:)

 For the sake of discussion, lets also say I have another component
 called
 Invoice that needs two Person objects, one for Ordering Person and
 another
 for Ship To person.  I can't just use extends because that creates a
 single
 person instance.   How do I code this?

extends represents an is-a relationship:

car is-a vehicle

so

!--- car.cfc ---
cfcomponent extends=vehicle
...
/cfcomponent

is a reasonable model.

has-a is modeled by 'containment' - having data members:

Invoice has-a Ordering Person
Invoice has-a ShipTo Person

so

!--- invoice.cfc ---
cfcomponent
cffunction name=create
cfargument name=shipto type=person
cfargument name=orderer type=person
cfset this.shipto = arguments.shipto
cfset this.orderer = arguments.orderer
/cffunction
/cfcomponent

Hope that helps?

Sean A Corfield -- http://www.corfield.org/blog/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: CFC Question

2003-01-31 Thread Sean A Corfield
On Friday, Jan 31, 2003, at 05:52 US/Pacific, Andy Ousterhout wrote:
 Ok, so in your example, Invoice has-a Ordering Person, how do I set
 FirstName?

 Invoice.OrderingPerson.setFirst(Sean); ?

Not quite - see below.

   !--- invoice.cfc ---
   cfcomponent
   cffunction name=create
   cfargument name=shipto type=person
   cfargument name=orderer type=person
   cfset this.shipto = arguments.shipto
   cfset this.orderer = arguments.orderer
   /cffunction
   /cfcomponent

You use this as follows:

!--- create shipping person ---
cfset shiptoperson = createObject(component,person)
cfset shiptoperson.setFirstName(Sean)
!--- similarly, create an orderingperson ---
!--- set up invoice ---
cfset inv = createObject(component,invoice)
cfset inv.create(shiptoperson,orderingperson)

Or you can just use this scope to have publicly accessible data 
members:

cfset inv = createObject(component,invoice)
cfset inv.shipto = createObject(component,person)
cfset inv.shipto.setFirstName(Sean)
cfset inv.orderer = createObject(component,person)
cfset inv.orderer.setFirstName(Joe)

Sean A Corfield -- http://www.corfield.org/blog/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: CFC Question

2003-01-31 Thread Andy Ousterhout
Thanks.

I thought that you'd be able to hide the has-a relationship from the
accessing programs and perform this in the Invoice Object Methods.  I see
from this and documentation at Macromedia that the accessing program such as
the Invoice Form, create the relationship explicitly.

Again, thanks for taking the time to educate me.

Andy

-Original Message-
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 11:08 AM
To: CF-Talk
Subject: Re: CFC Question


On Friday, Jan 31, 2003, at 05:52 US/Pacific, Andy Ousterhout wrote:
 Ok, so in your example, Invoice has-a Ordering Person, how do I set
 FirstName?

 Invoice.OrderingPerson.setFirst(Sean); ?

Not quite - see below.

   !--- invoice.cfc ---
   cfcomponent
   cffunction name=create
   cfargument name=shipto type=person
   cfargument name=orderer type=person
   cfset this.shipto = arguments.shipto
   cfset this.orderer = arguments.orderer
   /cffunction
   /cfcomponent

You use this as follows:

!--- create shipping person ---
cfset shiptoperson = createObject(component,person)
cfset shiptoperson.setFirstName(Sean)
!--- similarly, create an orderingperson ---
!--- set up invoice ---
cfset inv = createObject(component,invoice)
cfset inv.create(shiptoperson,orderingperson)

Or you can just use this scope to have publicly accessible data
members:

cfset inv = createObject(component,invoice)
cfset inv.shipto = createObject(component,person)
cfset inv.shipto.setFirstName(Sean)
cfset inv.orderer = createObject(component,person)
cfset inv.orderer.setFirstName(Joe)

Sean A Corfield -- http://www.corfield.org/blog/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Re: CFC Question

2003-01-30 Thread Sean A Corfield
On Thursday, Jan 30, 2003, at 21:58 US/Pacific, Andy Ousterhout wrote:
 OK, I am hooked after only a few hours on CFC's.  This is so much 
 easier to
 code that what I was trying to do with modules  includes in 5.0

:)

 For the sake of discussion, lets also say I have another component 
 called
 Invoice that needs two Person objects, one for Ordering Person and 
 another
 for Ship To person.  I can't just use extends because that creates a 
 single
 person instance.   How do I code this?

extends represents an is-a relationship:

car is-a vehicle

so

!--- car.cfc ---
cfcomponent extends=vehicle
...
/cfcomponent

is a reasonable model.

has-a is modeled by 'containment' - having data members:

Invoice has-a Ordering Person
Invoice has-a ShipTo Person

so

!--- invoice.cfc ---
cfcomponent
cffunction name=create
cfargument name=shipto type=person
cfargument name=orderer type=person
cfset this.shipto = arguments.shipto
cfset this.orderer = arguments.orderer
/cffunction
/cfcomponent

Hope that helps?

Sean A Corfield -- http://www.corfield.org/blog/

If you're not annoying somebody, you're not really alive.
-- Margaret Atwood

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: CFC Question

2003-01-01 Thread Raymond Camden
Just be sure your values are simple - if you had a struct where the
value of yourStruct[key] was also a struct, the code below would
generate an error. As the later poster said - just use cfdump. ;)
Although if you want more control over the look and feel, start w/
Matt's code below. If your values are all simple, it will work fine - if
it's more complex, you would just need to modify.

===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc

Email: [EMAIL PROTECTED]
WWW  : www.camdenfamily.com/morpheus
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Matt Liotta [mailto:[EMAIL PROTECTED]] 
 Sent: Tuesday, December 31, 2002 3:00 PM
 To: CF-Talk
 Subject: RE: CFC Question
 
 
 cfscript
   for(key in yourStruct)
   WriteOutput(key  :  yourStruct[key]);
 /cfscript
 
 
 Matt Liotta
 President  CEO
 Montara Software, Inc.
 http://www.montarasoftware.com/
 888-408-0900 x901
 
  -Original Message-
  From: Cutter (CF_Talk) [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 31, 2002 3:42 PM
  To: CF-Talk
  Subject: CFC Question
  
  I know that this has been asked, but I can't find it in the archives
  
  I have created a CFC with a function getTitle. The function has a
 return
  type of struct. After calling the function through 
 CFInvoke, how do I 
  loop through the struct to display my data? There doesn't 
 appear to be
 a
  lot of information on this at MM...
  
  Cutter
  

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



  1   2   >