Yes, Exactly what I did today .... A bit tricky to play with Evaluate when you have to pass function names and function arguments .....Another problem is scoping, functions passed by reference are known everywhere down ... but not when passed by name ......
Dominique -----Original Message----- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 6:52 PM To: CF-Talk Subject: RE: WDDX and UDF Hmm, something else to consider. You can pass the name of a UDF to a UDF and then call it dynamically... function alpha() { return "a"; } function beta() { return "b"; } function main(f) { return f(); } writeOutput(main("alpha")); There is an example of a sort UDF on cflib.org that works like this. Would this help? ======================================================================= 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: D. Delcomminette [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 05, 2003 9:38 PM > To: CF-Talk > Subject: RE: WDDX and UDF > > > Your suggestion is good as soon as the set of function is > pre-defined and well known, which is not the case. The object > I am talking about is part of a completely dynamic > development framework and must be able to handle other set of > functions without changing the code. > > Dominique > > > -----Original Message----- > From: Raymond Camden [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 05, 2003 7:36 PM > To: CF-Talk > Subject: RE: WDDX and UDF > > Why store the udf as a preference? I'd just store a string, > ie, pageA.display="thumbnail" or pageA.display="Summary", > then you could do: > > <cfif pageA.display is "thumbnail"> > <cfoutput>#displayThunbnail(.... etc > > Or even easier. Write a UDF called displayContent. It takes > as an arg what style to display and the data to show. So you could do: > > displayContent("thunbmail",artistnail) > > ============================================================== > ========= > 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: DDE [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, February 05, 2003 1:17 AM > > To: CF-Talk > > Subject: RE: WDDX and UDF > > > > > > It is much more complex than that and it doesn't concern pages but > > display objects ... Anyway I will add to your example so that it is > > closer to what I need, each "page" also has a couple of functions > > defined by default and these one can also be changed by the user. > > Let's take your page a as an example: > > > > Page A > > Background color: red > > Music: techno > > UDF1: DisplayThumbnail > > UDF1_param: ArtistName > > UDF2: Playsong > > UDF2_param: SongName > > > > As a user I can choose to replace DisplayThumbnail by > DisplayResume or > > PlaySong by PlayVideo and UDF2_param by ClipName, and save it to my > > preferences. > > > > DO you have a better idea of what I mean ?? > > > > Thanks > > > > Dominique > > > > > > > > > > -----Original Message----- > > From: Raymond Camden [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 04, 2003 10:13 PM > > To: CF-Talk > > Subject: RE: WDDX and UDF > > > > So wait a minute - you mean your data structure looks like this - > > kinda: > > > > Preferences > > Page A > > background color: red > > music: techno > > > > Page B > > coolness factor: high > > hipness factor: can't walk through doors > > > > If so - why not simply store the preferences in a structure? How > > exactly are you using the dynamic UDFs? > > > > ============================================================== > > ========= > > 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: D. Delcomminette [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, February 04, 2003 11:32 AM > > > To: CF-Talk > > > Subject: RE: WDDX and UDF > > > > > > > > > Yeah, almost. Users can save preferences but I cannot use > > the simple > > > method you describe, because the same thig happens on > > different pages. > > > I mena users can save preferences for different pages and > the same > > > object has to handle all of them. So, I really need to save > > for user x > > > preference for page y a whole bunch of parameters amongst which a > > > couple of functions. > > > > > > > > > > > > -----Original Message----- > > > From: Raymond Camden [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, February 04, 2003 8:48 PM > > > To: CF-Talk > > > Subject: RE: WDDX and UDF > > > > > > Are you saying that based on user input, you would need to call a > > > function but you don't know which at runtime? If your options are > > > limited (let's say 3 differnet UDFs), you could use a simple cfif > > > block... > > > > > > <cfif foo is 1> > > > <cfset x = goo()> > > > <cfelseif foo is 2> > > > <cfset x = moo()> > > > <cfelseif foo is 3> > > > <cfset x = doodoo()> > > > </cfif> > > > > > > Or, you can consider writing one UDF and passing the option (foo > > > above) to the UDF. > > > > > > ============================================================== > > > ========= > > > 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: D. Delcomminette [mailto:[EMAIL PROTECTED]] > > > > Sent: Tuesday, February 04, 2003 10:34 AM > > > > To: CF-Talk > > > > Subject: RE: WDDX and UDF > > > > > > > > > > > > Ouuuuuuuups ..... I wish my English was better ............. > > > > > > > > I do not want to store anything as a function, but I have > > > to! Because > > > > some parameters amongst others are just the function the > > > user chooses > > > > to places at some point . > > > > > > > > Can't find how to explain it in another way. > > > > > > > > Thanks for your patience. > > > > > > > > Dominique > > > > > > > > > > > > -----Original Message----- > > > > From: webguy [mailto:[EMAIL PROTECTED]] > > > > Sent: Tuesday, February 04, 2003 8:00 PM > > > > To: CF-Talk > > > > Subject: RE: WDDX and UDF > > > > > > > > Ok understand that. But what I don't understand is why > > you need to > > > > store the preferences as a function. > > > > > > > > Can't you just store the "struc of array of struct" ? > > > > > > > > WG > > > > > > > > > -----Original Message----- > > > > > From: DDE [mailto:[EMAIL PROTECTED]] > > > > > Sent: 04 February 2003 15:42 > > > > > To: CF-Talk > > > > > Subject: RE: WDDX and UDF > > > > > > > > > > > > > > > OK, I'll try to explain a bit more , but I can't give > > > full details > > > > > otherwise it will become to complex. I have a struc > of array of > > > > > struct and so on ... A part of is a description of > > > columns appearing > > > > > in a dhtml > > > > table. For each > > > > > column, I have a name, a datatype, a filter value ...... > > > > and an optional > > > > > reference to formatting function ... > > > > > Most of those data can be customized per user. That's the > > > reason why > > > > > I have to save it somewhere, and I choose to save in a user > > > > related table of my > > > > > database. I tried to store just the name of the function as > > > > a string, but > > > > > than I have other problems in the object managing the > all stuff. > > > > > > > > > > Hope you get a better idea. > > > > > > > > > > Thanks Dominique > > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: webguy [mailto:[EMAIL PROTECTED]] > > > > > Sent: Tuesday, February 04, 2003 6:16 PM > > > > > To: CF-Talk > > > > > Subject: RE: WDDX and UDF > > > > > > > > > > Typo.. > > > > > > > > > > > if you do a = myfunction(a,b,c); ... "a" will contain > > > the return > > > > > > code, unless you return the struct of array of struct (as > > > > a struct), > > > > > > which you should be able to store as wddx > > > > > > > > > > should read > > > > > > > > > > if you do a = myfunction(a,b,c); ... "a" will contain > > the return > > > > > code. > > > > > > > > > > if you return the struct of array of struct (as a > > > > struct),you should > > > > > be able to store as wddx > > > > > > > > > > WG > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=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

