This code snippet fails in 5.
function test(Query, ItemID)
{
return Evaluate('ValueList(Query.#ItemID#)');
}
<CFOUTPUT>#test(qQuery, 'counter')#</CFOUTPUT>
> What doesn't it like? If you pass a query to a udf, you pass it by ref.
> If you are just getting the valuelist, this is harmless. If you are
> actually manipulating the query in the UDF, then you can either
> duplicate it in the udf or duplicate it on call:
>
> <cfset newQ = myUDF(duplicate(oldQuery))>
>
> =======================================================================
> Raymond Camden, ColdFusion Jedi Master for Macromedia
>
> Email : [EMAIL PROTECTED]
> Yahoo IM : morpheus
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 10, 2002 12:24 PM
> > To: CF-Talk
> > Subject: Re: dynamic valuelist
> >
> >
> > Thanks. Very sneaky. Now if I can just get past CF not liking
> > the passed query. :)
> > (which I assume is due to the query being passed by
> > reference, not value)
> >
> > > Sure, just do:
> > >
> > > <cfset res = evaluate("valuelist(query.#itemid#)")>
> > >
> > > FYI - this is one of the FEW times you need Evaluate.
> > > FYI2 - A UDF for this was written by one of my coworkers
> > and will be up
> > > on CFLib.org soon.
> > >
> > >
> > ==============================================================
> > =========
> > > Raymond Camden, ColdFusion Jedi Master for Macromedia
> > >
> > > Email : [EMAIL PROTECTED]
> > > Yahoo IM : morpheus
> > >
> > > "My ally is the Force, and a powerful ally it is." - Yoda
> > >
> > > > -----Original Message-----
> > > > From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, July 10, 2002 12:01 PM
> > > > To: CF-Talk
> > > > Subject: dynamic valuelist
> > > >
> > > >
> > > > The ValueList() function takes as its attribute the name of a
> > > > query field. This is passed in without quotes (essentially
> > > > breaking the rule of non-quoted variables inside functions
> > > > being evaluated). What I want to do is create a UDF and pass
> > > > in a query and the name of a column. These are to be combined
> > > > within a ValueList() to be evaluated.
> > > >
> > > > var Items = ValueList(evaluate('Query.'&ItemID));
> > > >
> > > > This fails. Does anyone have a suggestion as to how I can
> > > > create the attribute for the valuelist dynamically or should
> > > > I just run a loop (which is just a few milliseconds slower).
> > > >
> > > > Michael Dinowitz
> > > > Master of the House of Fusion
> > > > http://www.houseoffusion.com
> > > >
> > > >
> > >
> >
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists