Oh and you might also try this:

<cfset theMethodIWantToRun = myService["save#ARGUMENTS.myTable#"]>
<cfset theMethodIWantToRun(myBeanObj)>

I have a feeling this doesn't work as I remember doing something like this
in the past and then went back to using cfinvoke.

Adrian

-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: 10 September 2008 16:34
To: CF-Talk
Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse
topic)


Try...

<cfset myService = APPLICATION[ARGUMENTS.myTable & "Service"]>

This would be nice:

<cfset myService["save" & ARGUMENTS.myTable](myBeanObj)>

But instead you have to do:

<cfinvoke component="#myService#" method="save#ARGUMENTS.myTable#"
returnvariable="aVarIfYouWantOne">
        <cfinvokeargument name="myBeanObj" value="#myBeanObj#">
</cfinvoke>

Check that cfinvoke though, I don't normally use it.

Adrian

-----Original Message-----
From: Gerald Guido [mailto:[EMAIL PROTECTED]
Sent: 10 September 2008 16:15
To: CF-Talk
Subject: Re: How NOT to Evaluate (moved from cfset so not to confuse
topic)


While we are on the subject. I know I have asked this before.... But I still
haven't figured out a way to do this.
I have a bunch of CFC's loaded in memory that I want to call based on the
The table name. Is there a way to avoid using evaluate in cases like this:

  <cfset MyServiceObj = evaluate("Application.#arguments.MyTable#Service")
/>

    <cfset mystring = "MyServiceObj.save#arguments.MyTable#(myBeanObj)" />

 <cfreturn  evaluate(mystring)  />

Many TIA

~G~

On Wed, Sep 10, 2008 at 10:55 AM, Adrian Lynch
<[EMAIL PROTECTED]>wrote:

> Good question.
>
> [] are CF constructs. These two are equivalent:
>
> FORM.someVar = 101
>
> and
>
> FORM["someVar"] = 101
>
> You'd use the latter for dynamic variable names:
>
> FORM["someVar" & i]
>
> Deffo use cfqps, have a look back in the cf-talk archives to see a bunch
of
> trouble caused by the lack of them in SQL statements.
>
> Also take note of Mark's post, the fact you're creating column names
> dynamically will also be a problem, one that cfqp can't solve.
>
> Adrian
>
>

--
"We would be eternally miserable if our errors worried us too much because
as we push forward we will make plenty more."

—Ernest O. Lawrence


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

Reply via email to