From: Dave Phipps on
Hi,

I have 2 cfc methods one receives 3 arguments, id,fieldid,fieldvalue. Where
fieldid is a db column name and fieldvalue is the value of that field. I want
to pass this info to another method which accepts many more optional arguments.
I would like to use the arguments.field as the name of an argument for the 2nd
method

e.g. my2ndmethod(arguments.fieldid=arguments.fieldvalue)

However, this doesn't seem to be working. Is there anyway to do this other
than using a switch case on arguments.fieldid and then hardcoding each possible
fieldid in each cfcase?

Any ideas/suggestions/workarounds?

Many thanks,

Dave

From: Dan Bracuk on
if I understand the question correctly,
argumentcollection=arguments
is one of my favourite attributes when using cfinvoke
From: Dave Phipps on
But wouldn't argumentcollection pass arguments.fieldid and arguments.field
value to the 2nd method? My second method would not know what fieldid was.

arguments.fieldid could be anything for that particular data table e.g.
firstname or lastname. arguments.fieldvalue holds the corresponding value of
that field e.g. Dave or Phipps.

My 2nd method has arguments for firstname, lastname so argumentCollection
would not fit in this situation.

Although could I use cfinvokeargument?? I'll try it in the morning! (00:22
here).

I think I have had a lightbulb moment.

Thanks Dan, you might have pointed me in the right direction!

Cheers,

Dave

From: vxvx on
On Apr 21, 3:19 am, "Dave Phipps" <webforumsu...(a)macromedia.com>
wrote:
> Hi,
>
> I have 2 cfc methods one receives 3 arguments, id,fieldid,fieldvalue. Where
> fieldid is a db column name and fieldvalue is the value of that field. I want
> to pass this info to another method which accepts many more optional arguments.
> I would like to use the arguments.field as the name of an argument for the 2nd
> method
>
> e.g. my2ndmethod(arguments.fieldid=arguments.fieldvalue)
>
> However, this doesn't seem to be working. Is there anyway to do this other
> than using a switch case on arguments.fieldid and then hardcoding each possible
> fieldid in each cfcase?
>
> Any ideas/suggestions/workarounds?
>
> Many thanks,
>
> Dave

hi
u can try this "<cfset super.get(argumentCollection = arguments)>
"this is an examples of passing a argumentCollection to the another
function.
From: Dave Phipps on
Problem solved. I used cfinvoke to invoke the second method and then used cfinvokeargument name="#arguments.fieldid#" value="#arguments.fieldvalue#" and it works a treat!!

Cheers,

Dave