cfset this.scriptProtect = No
Hi. I have a question about the wisdom of disabling the scriptProtect function in application.cfc. In my application.cfc, I have set cfset this.scriptProtect = No . like this: cfcomponent output=false cfset this.scriptProtect = No I did this to allow my client to paste the OBJECT tag into TinyMCE in her content management system. Previously, when she pasted: OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-44455354 codebase=http://fpdownload.macromedia.com/get/flashplayer/current/swflash.c ab id=Player_8fb00b70-06ad-4ced-acd0-5ba940ba131c WIDTH=500px HEIGHT=175px .. etc . ..ColdFusion would replace OBJECT with InvalidTag. She needs to paste in embed codes for various Amazon widgets. I have read up on Pete Freitag's notes about the scriptProtect function. My question: is there a safer way to allow my client to paste in her Amazon widgets into TinyMCE? I prefer to not turn off scriptProtect , even if its protection is incomplete. Thank you for any advice. Eric p.s. in my edit form (which updates the data table) I have set: !--- in user-editable form fields, set up protection against XSS --- cfloop collection=#FORM# item=field cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], script.*?.*?/script, , all) /cfloop I do not know if that offsets disabling the scriptProtect function. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353830 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
append with cfset
I thought CF could appended data in a cfset tag like: cfset foo = boo cfset foo =+ moo So if you output foo you would get boomoo. Or am I thinking of another language? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353702 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: append with cfset
I believe that should be += and I think that started working in CF9. -Original Message- From: Chad Gray [mailto:cg...@careyweb.com] Sent: Thursday, December 27, 2012 2:04 PM To: cf-talk Subject: append with cfset I thought CF could appended data in a cfset tag like: cfset foo = boo cfset foo =+ moo So if you output foo you would get boomoo. Or am I thinking of another language? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353703 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: append with cfset
I do it that way and it tries to use addition (math) not append. -Original Message- From: DURETTE, STEVEN J [mailto:sd1...@att.com] Sent: Thursday, December 27, 2012 2:05 PM To: cf-talk Subject: RE: append with cfset I believe that should be += and I think that started working in CF9. -Original Message- From: Chad Gray [mailto:cg...@careyweb.com] Sent: Thursday, December 27, 2012 2:04 PM To: cf-talk Subject: append with cfset ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353704 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: append with cfset
Oh, good point... try = that is a guess so I don't guarantee it. -Original Message- From: Chad Gray [mailto:cg...@careyweb.com] Sent: Thursday, December 27, 2012 2:10 PM To: cf-talk Subject: RE: append with cfset I do it that way and it tries to use addition (math) not append. -Original Message- From: DURETTE, STEVEN J [mailto:sd1...@att.com] Sent: Thursday, December 27, 2012 2:05 PM To: cf-talk Subject: RE: append with cfset I believe that should be += and I think that started working in CF9. -Original Message- From: Chad Gray [mailto:cg...@careyweb.com] Sent: Thursday, December 27, 2012 2:04 PM To: cf-talk Subject: append with cfset ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353705 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: append with cfset
AH! Good guess. That worked. Thanks! -Original Message- From: DURETTE, STEVEN J [mailto:sd1...@att.com] Sent: Thursday, December 27, 2012 2:11 PM To: cf-talk Subject: RE: append with cfset Oh, good point... try = that is a guess so I don't guarantee it. -Original Message- From: Chad Gray [mailto:cg...@careyweb.com] Sent: Thursday, December 27, 2012 2:10 PM To: cf-talk Subject: RE: append with cfset I do it that way and it tries to use addition (math) not append. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353706 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: append with cfset
Any time! :) -Original Message- From: Chad Gray [mailto:cg...@careyweb.com] Sent: Thursday, December 27, 2012 2:18 PM To: cf-talk Subject: RE: append with cfset AH! Good guess. That worked. Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353707 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
How to set cfset session variable to be called in a cfc?
With the following code from two cfc files, how do I pass the result from getAllAsStruct in CustomerGateway.cfc to exportToExcel, #arguments.data#, in Export.cfc? My environment is set up for using session variables. I need to cfset session.exportData somewhere so that it can be called? How do I hook them up so that the getAllAsStruct array is available as #arguments.data#. Export.cfc cfcomponent cffunction name=exportToExcel access=remote returntype=boolean output=true cfargument name=data type=string required=yes default= / cfset session.exportData = #arguments.data# cflog text=data to be exported: #session.exportData#/ cfreturn true /cffunction /cfcomponent CustomerGateway.cfc cffunction name=getAllAsStruct output=false access=remote returntype=array cfset var qRead= cfset var aRead = []/ cfset var sRead = {}/ cfquery name=qRead datasource=#application.dsn# select * from sav_customer /cfquery cfloop query=qRead cfset sRead = {}/ cfset sRead[__type__] = stardust.cfc.Contact/ cfset sRead[id_rssd] = qRead.id_rssd/ cfset sRead[ctct_id] = qRead.ctct_id/ cfset sRead[ser_id] = qRead.ser_id/ cfset sRead[inst_nm] = qRead.inst_nm/ cfset sRead[ctct_fst_nm] = qRead.ctct_fst_nm/ cfset sRead[ctct_lst_nm] = qRead.ctct_lst_nm/ cfset sRead[updt_dt] = qRead.updt_dt/ cfset arrayAppend(aRead, sRead)/ /cfloop cfreturn aRead /cffunction I am learning yet... Thank you for your help. Faye Larson ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340575 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to set cfset session variable to be called in a cfc?
Faye, On Fri, Jan 7, 2011 at 1:05 PM, Faye Larson fz...@yahoo.com wrote: With the following code from two cfc files, how do I pass the result from getAllAsStruct in CustomerGateway.cfc to exportToExcel, #arguments.data#, in Export.cfc? My environment is set up for using session variables. I need to cfset session.exportData somewhere so that it can be called? Obviously, I don't know exactly what you're trying to do, but here's a pretty good guess: the real point is to export some customer data as an Excel file. So you probably want another CFC (call it a service component), perhaps called CustomerService.cfc. In there you may have a method called exportCustomerData, which might possibly take some arguments, such as a Customer Type, a date range, or other filtering mechanisms. The CustomerService would call a method on CustomerGateway that retrieves the query data. While the gateway *could* build the struct, you generally want to leave that sort of work to another component, using the gateway strictly for database interaction. So perhaps the gateway's method is just GetAll (or whatever's appropriate, depending on whether you need to apply filters in the query), and you build the struct (or array, or just leave it as a query, depending on what you need), in the CustomerService. Then the CustomerService calls the Export.cfc's method, and does whatever's necessary - saving the spreadsheet, returning it to the browser, whatever. Unless you have a reason to persist the query data from request to request, you don't want or need to place it in the session scope. So: 1. Request calls method on CustomerService, optionally with filter data. 2. CustomerService calls CustomerGateway to get data, optionally with filter. 3. CustomerService manipulates data into what array/structure/etc. you want (this could even be done by some sort of utility cfc) 4. CustomerService call Export.exportToExcel(data), passing in the data it has manipulated. 5. CustomerService completes its action by returning the filename of the spreadsheet, or whatever's appropriate to your needs. From there on, it kinda depends on what you want to do with the spreadsheet. -- Thanks, Tom Tom McNeer MediumCool http://www.mediumcool.com 1735 Johnson Road NE Atlanta, GA 30306 404.589.0560 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340579 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to set cfset session variable to be called in a cfc?
I am trying to export the data which is an arrayCollection in Flex to Excel. I followed this article, http://viconflex.blogspot.com/2007/02/export-data-from-flex-app-using.html, and got all the components working. Now the last step is to make the data (arrayCollection) available in #arguments.data#, I guess. I am very new with ColdFusion. I have used Flex for awhile with Java as the backend. I appreciate it if you can help me to resolve this last step. Thank you very much. Faye Larson Dallas Faye, Obviously, I don't know exactly what you're trying to do, but here's a pretty good guess: the real point is to export some customer data as an Excel file. So you probably want another CFC (call it a service component), perhaps called CustomerService.cfc. In there you may have a method called exportCustomerData, which might possibly take some arguments, such as a Customer Type, a date range, or other filtering mechanisms. The CustomerService would call a method on CustomerGateway that retrieves the query data. While the gateway *could* build the struct, you generally want to leave that sort of work to another component, using the gateway strictly for database interaction. So perhaps the gateway's method is just GetAll (or whatever's appropriate, depending on whether you need to apply filters in the query), and you build the struct (or array, or just leave it as a query, depending on what you need), in the CustomerService. Then the CustomerService calls the Export.cfc's method, and does whatever's necessary - saving the spreadsheet, returning it to the browser, whatever. Unless you have a reason to persist the query data from request to request, you don't want or need to place it in the session scope. So: 1. Request calls method on CustomerService, optionally with filter data. 2. CustomerService calls CustomerGateway to get data, optionally with filter. 3. CustomerService manipulates data into what array/structure/etc. you want (this could even be done by some sort of utility cfc) 4. CustomerService call Export.exportToExcel(data), passing in the data it has manipulated. 5. CustomerService completes its action by returning the filename of the spreadsheet, or whatever's appropriate to your needs. From there on, it kinda depends on what you want to do with the spreadsheet. -- Thanks, Tom Tom McNeer MediumCool http://www.mediumcool.com 1735 Johnson Road NE Atlanta, GA 30306 404.589.0560 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340580 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to set cfset session variable to be called in a cfc?
Faye, On Fri, Jan 7, 2011 at 1:54 PM, Faye Larson fz...@yahoo.com wrote: I am trying to export the data which is an arrayCollection in Flex to Excel. I followed this article, http://viconflex.blogspot.com/2007/02/export-data-from-flex-app-using.html, and got all the components working. Now the last step is to make the data (arrayCollection) available in #arguments.data#, I guess. I'll need a little more explanation. Your original example was a ColdFusion query. Now you say it's data coming from Flex. Is it being created from scratch in Flex? Didn't it originate as server-side data? ColdFusion is just Java under the hood, and you'll find you'll use many of the same patterns. If you can walk us through the process - basically, how did Flex get the data, how was it manipulated, and such - what it's returning - we can probably help. It would also help to know what's supposed to happen with the spreadsheet. Is it to be displayed, just saved, or what? As much detail as you can provide on the steps in the process, please. -- Thanks, Tom Tom McNeer MediumCool http://www.mediumcool.com 1735 Johnson Road NE Atlanta, GA 30306 404.589.0560 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340581 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to set cfset session variable to be called in a cfc?
Faye, I am trying to export the data which is an arrayCollection in Flex to Excel. I followed this article, http://viconflex.blogspot.com/2007/02/export-data-from-flex-app-using.html, and got all the components working. Now the last step is to make the data (arrayCollection) available in #arguments.data#, I guess. I'll need a little more explanation. Your original example was a ColdFusion query. Now you say it's data coming from Flex. Is it being created from scratch in Flex? Didn't it originate as server-side data? ColdFusion is just Java under the hood, and you'll find you'll use many of the same patterns. If you can walk us through the process - basically, how did Flex get the data, how was it manipulated, and such - what it's returning - we can probably help. It would also help to know what's supposed to happen with the spreadsheet. Is it to be displayed, just saved, or what? As much detail as you can provide on the steps in the process, please. -- Thanks, Tom Tom McNeer MediumCool http://www.mediumcool.com 1735 Johnson Road NE Atlanta, GA 30306 404.589.0560 The Flex datagrid page calls getAllAsStruct method in CustomerGateway.cfc which returns the array to Flex. private function buttonHandler():void { roWildcard.getAllAsStruct(); } mx:RemoteObject id=roWildcard destination=ColdFusion source=DeptApps.Statistics.Faye.stardust.cfc.CustomerGateway showBusyCursor=true result=resultHandler(event) fault=faultHandler(event)/ The array is displayed here, mx:DataGrid id=dg dataProvider={roResults} width=100% height=100%/ Then, I am calling the exportToExcel method in Export.cfc which is supposed to get the array from the above. It will return a boolean. private function test():void{ exportManager.exportToExcel( + + The application has successfully exported this file + Eventually the actual data will be passed into this function + ); } If the above is true, I will then call a cfm file to spit it out. cfsetting enablecfoutputonly=true showdebugoutput=No cfheader name=Content-Disposition value=attachment; filename=export.xls/ cfcontent type=application/vnd.ms-excel reset=true/ cfscript WriteOutput(session.exportData); /cfscript cfexit / We want to allow the user to choose where to save their data when it opens excel. My problem is, session.exportData is not tied in with the result from getAllAsStruct method in CustomerGateway.cfc It brings up Excel allowing to choose the location to save the file but the spreadsheet opens up with no data. I hope this helps to clear up some confusion. Thank you again. Faye Larson, Dallas ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340582 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to set cfset session variable to be called in a cfc?
source=DeptApps.Statistics.Faye.stardust.cfc.Export showBusyCursor=true mx:method name=exportToExcel result=login_result(event) fault=serverFault(event) / /mx:RemoteObject mx:Panel title={this.label} width=100% height=100% mx:HBox mx:Button label=Call RemoteObject click=buttonHandler()/ mx:Button label=Export click=test()/ /mx:HBox mx:DataGrid id=dg dataProvider={roResults} width=100% height=100%/ /mx:Panel /mx:Canvas CustomerGateway.cfc cfcomponent output=false !--- Populating an array from a query, an array of CFML structures --- cffunction name=getAllAsStruct output=false access=remote returntype=array cfset var qRead= cfset var aRead = []/ cfset var sRead = {}/ cfquery name=qRead datasource=#application.dsn# select * from sav_customer /cfquery cfloop query=qRead cfset sRead = {}/ cfset sRead[__type__] = stardust.cfc.Contact/ cfset sRead[id_rssd] = qRead.id_rssd/ cfset sRead[ctct_id] = qRead.ctct_id/ cfset sRead[ser_id] = qRead.ser_id/ cfset sRead[inst_nm] = qRead.inst_nm/ cfset sRead[ctct_fst_nm] = qRead.ctct_fst_nm/ cfset sRead[ctct_lst_nm] = qRead.ctct_lst_nm/ cfset sRead[updt_dt] = qRead.updt_dt/ cfset arrayAppend(aRead, sRead)/ /cfloop cfreturn aRead /cffunction /cfcomponent Export.cfc cfcomponent cffunction name=exportToExcel access=remote returntype=boolean output=true cfargument name=data type=string required=yes default= / cfset session.exportData= #arguments.data# cflog text=data to be exported: #session.exportData#/ cfreturn true /cffunction /cfcomponent getExcelFile.cfm cfsetting enablecfoutputonly=true showdebugoutput=No cfheader name=Content-Disposition value=attachment; filename=export.xls/ cfcontent type=application/vnd.ms-excel reset=true/ cfscript WriteOutput(session.exportData); /cfscript cfexit / == Code ends here I need to know how to set session.exportData to the return from CustomerGateway return method. Do I need to create another function? Thank you very much for your time. Faye Larson Dallas ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340583 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to set cfset session variable to be called in a cfc?
Faye, The way you're handling the export has a number of issues. If you don't mind, I'll suggest a somewhat different flow to the logic. I definitely would not use the session scope here. It's just not necessary. But first - have you actually tested your .cfm file by placing some data into the session scope, then seeing what comes out? Completely in isolation from Flex? I've never seen an attempt to create a spreadsheet this way, by simply outputting some data and giving it a spreadsheet content type: cfsetting enablecfoutputonly=true showdebugoutput=No cfheader name=Content-Disposition value=attachment; filename=export.xls/ cfcontent type=application/vnd.ms- excel reset=true/ cfscript WriteOutput(session.exportData); /cfscript cfexit / I'm not certain, but I don't think it will work. In your .cfm file, set session.data to something and see what you get. I'm guessing it won't work, but I could be wrong. I've created many spreadsheets from ColdFusion, and they always require a good bit of manipulation, or the use of the cfspreadsheet tags and functions in later versions. I don't think you can just dump the data in that way, although perhaps since it's a struct, it'll work. I don't know. But there are certainly lots of ways in CF to create spreadsheets from data structures cleanly, and I'd suggest using one. So make sure you can actually create a spreadsheet, with valid data, before you go further. Here's how I would suggest you make things flow:(Again, this is with the assumption that the methods need no arguments for filtering.) - In your button handler, do not make a remote object call. Instead, go ahead and make your URLRequest to the .cfm file. - In your .cfm file, create an instance of your gateway and retrieve the data. - Then create an instance of your export cfc, call its method and pass in the data retrieved in the previous step. - Now do whatever's necessary to actually create everything as a spreadsheet. It could be simpler - create a method in a cfc called exportCustomerData which wraps the calls to the gateway and to the export function. So the problem should have nothing to do with Flex. Just make a URLRequest to a .cfm file - with parameters, if necessary - then handle all the processing there. You can do all your testing without Flex being involved, by calling the page directly in a browser. Mainly, make certain you can create the spreadsheet properly from CF. That's the key. If none of this makes sense, or if you need more help, let me know a couple of things: - what version of CF you are using, and - whether you've tested creating the spreadsheet in a .cfm file that way -- Thanks, Tom Tom McNeer MediumCool http://www.mediumcool.com 1735 Johnson Road NE Atlanta, GA 30306 404.589.0560 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340587 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
getting cfx_imsmail and cfset to play nice?
I am currently trying to use the cfx_imsmail tag (custom tag available using inFusion Mail Server) and I have a question which I hope can be easily answered. I want to use the cfx_imsmail tag to replace a cfmail tag that uses a query attribute. I am using the query and queryfield attributes to automatically loop the same query. My problem is that while inside an attribute of the cfx_imsmail tag, my cfset tags seem to be ignored. I want to put in place some link tracking logic and also a cfinclude tag that calls a dynamic template name. I have tried to set up this data in a token_emailbody attribute, directly in the body attribute, and also directly in the html attribute, but nothing seems to work for me. a dumbed-down code snippet is attached below: cfx_imsmail header_to=#myquery.to_email# header_from=#myquery.from_email# smtpfrom=#myquery.from_email# header_subject=#myquery.subject# failto=graph...@gammasports.com parsetokens=yes renderplaintext=no log=yes priority=0 query=myquery queryfield=to_email html= cfsilent !--- tracking logic here --- cfset ... /cfsilent !--- dynamic include here --- cfinclude template='...' cfsilent !--- extra cfinvoke where I am erroring --- cfset var.myvariable = 'blah blah' ) cfinvoke component='my_component' method='do_this' cfinvokeargument name='this_argument' value='#var. myvariable#' / /cfinvoke /cfsilent Please note that the data contained in the html attribute of the cfx_imsmail tag in the above code example was taken directly from between the opening and closing cfmail tags that I'm trying to replace. The cfmail tag works without any problems at all times. I keep getting an error on line 57 stating that a variable is undefined, even though I have the variable being defined on line 54. This leads me to believe that the cfset I am using is not being executed. Is there anything I can do to get my cfset to behave properly while inside of the cfx_imsmail tag? I have had success looping the cfx_imsmail tag for my query, replacing query and queryfield attributes with the smtpto attribute, and using a cfsavecontent tag before the cfx_imsmail tag to build the content for the html attribute. I do not want to do it this way, as this is far less efficient than using the query and queryfield attributes. ~| 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:322413 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: getting cfx_imsmail and cfset to play nice?
I should add that I'm using cfx_imsmail version 3.3.2. The coolfusion.com website is really messed up at the moment, and link to files on the download page link to the same smtp installer file. Does anyone know where I can get the newest version of cfx_imsmail? Or an answer to the OP would be great too. I am currently trying to use the cfx_imsmail tag (custom tag available using inFusion Mail Server) and I have a question which I hope can be easily answered. I want to use the cfx_imsmail tag to replace a cfmail tag that uses a query attribute. I am using the query and queryfield attributes to automatically loop the same query. My problem is that while inside an attribute of the cfx_imsmail tag, my cfset tags seem to be ignored. I want to put in place some link tracking logic and also a cfinclude tag that calls a dynamic template name. I have tried to set up this data in a token_emailbody attribute, directly in the body attribute, and also directly in the html attribute, but nothing seems to work for me. a dumbed-down code snippet is attached below: cfx_imsmail header_to=#myquery.to_email# header_from=#myquery.from_email# smtpfrom=#myquery.from_email# header_subject=#myquery.subject# failto=graph...@gammasports.com parsetokens=yes renderplaintext=no log=yes priority=0 query=myquery queryfield=to_email html= cfsilent !--- tracking logic here --- cfset ... /cfsilent !--- dynamic include here --- cfinclude template='...' cfsilent !--- extra cfinvoke where I am erroring --- cfset var.myvariable = 'blah blah' ) cfinvoke component='my_component' method='do_this' cfinvokeargument name='this_argument' value='#var. myvariable#' / /cfinvoke /cfsilent Please note that the data contained in the html attribute of the cfx_imsmail tag in the above code example was taken directly from between the opening and closing cfmail tags that I'm trying to replace. The cfmail tag works without any problems at all times. I keep getting an error on line 57 stating that a variable is undefined, even though I have the variable being defined on line 54. This leads me to believe that the cfset I am using is not being executed. Is there anything I can do to get my cfset to behave properly while inside of the cfx_imsmail tag? I have had success looping the cfx_imsmail tag for my query, replacing query and queryfield attributes with the smtpto attribute, and using a cfsavecontent tag before the cfx_imsmail tag to build the content for the html attribute. I do not want to do it this way, as this is far less efficient than using the query and queryfield attributes. ~| 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:322417 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: using dynamic variable in cfset statement
more-serious-face I didn't! /more-serious-face :OD -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] serious face there's probably not one of us on this list that didn't used to use evaluate() before being taught to look at other alternatives (and i'm sure some who still do use it). it's all good. participating is how you learn. keep doing what you're doing. /serious face :) ~| 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:312293 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. On Wed, Sep 10, 2008 at 4:41 AM, Adrian Lynch [EMAIL PROTECTED] wrote: more-serious-face I didn't! /more-serious-face :OD -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] serious face there's probably not one of us on this list that didn't used to use evaluate() before being taught to look at other alternatives (and i'm sure some who still do use it). it's all good. participating is how you learn. keep doing what you're doing. /serious face :) ~| 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:312296 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: using dynamic variable in cfset statement
Good thing my names Adrian then! :O. -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: 10 September 2008 14:33 To: CF-Talk Subject: Re: using dynamic variable in cfset statement As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. On Wed, Sep 10, 2008 at 4:41 AM, Adrian Lynch [EMAIL PROTECTED] wrote: more-serious-face I didn't! /more-serious-face :OD -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] serious face there's probably not one of us on this list that didn't used to use evaluate() before being taught to look at other alternatives (and i'm sure some who still do use it). it's all good. participating is how you learn. keep doing what you're doing. /serious face :) ~| 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:312297 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: using dynamic variable in cfset statement
I hope no one Evaluates() this thread or I'll get a CF- ;).~David _ Get more out of the Web. Learn 10 hidden secrets of Windows Live. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312298 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: using dynamic variable in cfset statement
Ray, As I recall no evaluate( ) used to be engraved on your family crest. How times have changed :) -mark -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 8:33 AM To: CF-Talk Subject: Re: using dynamic variable in cfset statement As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. ~| 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:312299 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Ray wrote: As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. How then would you approach the following without Evaluate, because it was the only way I could get it to work: (oh, let the fun begin, the shame. I probably committed at least 7 deadly sins alone. And yes, I am using Access. Moan. Laughter.) In my ever growing need to expand my knowledge base (and look less like an idiot to this list) HELP? It's a query that accepts information from a Search field to run a query. cfquery name=getPhysicianRecords datasource=#DSN#SELECT *FROM ContactsWHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#Evaluate(FORM.#FORM.Field#)#'ORDER BY Contacts.LastName~David _ See how Windows connects the people, information, and fun that are part of your life. http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/ ~| 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:312302 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#FORM[FORM.Field]#' ORDER BY Contacts.LastName And then throw in some cfqueryparams. But what's more interesting is how to protect against SQL injection with Contacts.#FORM.Field#! Is it a problem? If you don't mind tightening things up a bit, check FORM.Field is one of the available columns. Adrian -Original Message- From: David Moore, Jr. [mailto:[EMAIL PROTECTED] Sent: 10 September 2008 15:04 To: CF-Talk Subject: Re: How NOT to Evaluate (moved from cfset so not to confuse topic) Ray wrote: As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. How then would you approach the following without Evaluate, because it was the only way I could get it to work: (oh, let the fun begin, the shame. I probably committed at least 7 deadly sins alone. And yes, I am using Access. Moan. Laughter.) In my ever growing need to expand my knowledge base (and look less like an idiot to this list) HELP? It's a query that accepts information from a Search field to run a query. cfquery name=getPhysicianRecords datasource=#DSN#SELECT *FROM ContactsWHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#Evaluate(FORM.#FORM.Field#)#'ORDER BY Contacts.LastName ~David ~| 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:312303 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
So FORM[FORM.FIELD] didn't work instead of Evaluate(FORM.#FORM.Field#)? On Wed, Sep 10, 2008 at 11:03 PM, David Moore, Jr. wrote: How then would you approach the following without Evaluate, because it was the only way I could get it to work: (oh, let the fun begin, the shame. I probably committed at least 7 deadly sins alone. And yes, I am using Access. Moan. Laughter.) In my ever growing need to expand my knowledge base (and look less like an idiot to this list) HELP? It's a query that accepts information from a Search field to run a query. cfquery name=getPhysicianRecords datasource=#DSN#SELECT *FROM ContactsWHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#Evaluate(FORM.#FORM.Field#)#'ORDER BY Contacts.LastName~David -- mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ ~| 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:312306 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
You need to make sure form.field contains a valid column and kill the query if it doesn't. Your use of evaluate is not the worst thing about this sample query (ha). Try this.. cfset colList = col1,col2,col3/ cfquery name=getPhysicianRecords datasource=#DSN# SELECT * FROM Contacts WHERE Contacts.ContactType = cfqueryparam cfsqltype=CF_SQL_CHAR value=Physician/ cfif listfindnocase(colList,form.field) AND Contacts.#form.field = cfqueryparam cfsqltype=CF_SQL_CHAR value=#form[form.field]#/ cfelse !--- ensure the query will fail --- AND 1 = 2 /cfif ORDER BY Contacts.LastName /cfquery Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: David Moore, Jr. [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 9:04 AM To: CF-Talk Subject: Re: How NOT to Evaluate (moved from cfset so not to confuse topic) Ray wrote: As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. How then would you approach the following without Evaluate, because it was the only way I could get it to work: (oh, let the fun begin, the shame. I probably committed at least 7 deadly sins alone. And yes, I am using Access. Moan. Laughter.) In my ever growing need to expand my knowledge base (and look less like an idiot to this list) HELP? It's a query that accepts information from a Search field to run a query. cfquery name=getPhysicianRecords datasource=#DSN#SELECT *FROM ContactsWHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#Evaluate(FORM.#FORM.Field#)#'ORDER BY Contacts.LastName~David _ See how Windows connects the people, information, and fun that are part of your life. http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/ ~| 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:312307 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
Adrian Wrote: SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#FORM[FORM.Field]#' ORDER BY Contacts.LastName What is the [] for. How would they be used. I have never used them at all. What is the protocal. Is that CF or SQL or... And then throw in some cfqueryparams. I am just starting to write in the cfqueryparams. That is a new one too. ~David _ Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312309 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
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 -Original Message- From: David Moore, Jr. [mailto:[EMAIL PROTECTED] Sent: 10 September 2008 15:44 To: CF-Talk Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic) Adrian Wrote: SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#FORM[FORM.Field]#' ORDER BY Contacts.LastName What is the [] for. How would they be used. I have never used them at all. What is the protocal. Is that CF or SQL or... And then throw in some cfqueryparams. I am just starting to write in the cfqueryparams. That is a new one too. ~David ~| 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:312311 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
David Moore, Jr. wrote: What is the [] for. How would they be used. That is called 'Array Notation'. All ColdFusion variables are now structures AKA 'Associative Array' or 'Hash' or many other names. But it means that you can dynamically reference the elements of complex variables by using the square brackets eliminating 99.78% the need to use evaluate. form[fieldName] is the same as evaluate('form.#fieldName#') This is also very useful when there are illegal variable names involved. This sometimes happens with forms, but is not uncommon with more complex XML structures. I.E. #form.my field# is illegal if rather unlikely. But it could be achieved with #form[my field]#. ~| 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:312312 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
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:312314 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
David, Everything in CF (starting with CFMX and partially before that) is an object that has a parent. For example, if I do the following: cfset x = 10/ I have created a member of the variables scope (variables is the object and x is the member). So I could do the following with x: cfoutput#x#/cfoutput cfoutput#variables.x#/cfoutput cfoutput#variables[x]#/cfoutput This is true of every scope in CF - application, variables, form, url, arguments, attributes, request, server, session. Each of these are objects with members. Why does cfoutput#x#/cfoutput work you ask? Because when CF sees a var that has no parent object specified it looks in the variables scope (followed by url and then form) and figures it out for you. This is done for convenience but the abstraction keeps you from understanding what is going on under the hood. -Mark Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: David Moore, Jr. [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 9:44 AM To: CF-Talk Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic) Adrian Wrote: SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#FORM[FORM.Field]#' ORDER BY Contacts.LastName What is the [] for. How would they be used. I have never used them at all. What is the protocal. Is that CF or SQL or... And then throw in some cfqueryparams. I am just starting to write in the cfqueryparams. That is a new one too. ~David _ Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!55 0F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312315 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Gerald Guido wrote: cfset MyServiceObj = evaluate(Application.#arguments.MyTable#Service)/ cfset mystring = MyServiceObj.save#arguments.MyTable#(myBeanObj) / cfreturn evaluate(mystring) / Many TIA Well I think the first line could be... cfset MyServiceObe = Application[arguments.MyTable 'Service] I'm still mulling over what the next code does. ~| 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:312316 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
A little correction: cfoutput#variables[x]#/cfoutput should be: cfoutput#variables[x]#/cfoutput Adrian -Original Message- From: Mark Kruger [mailto:[EMAIL PROTECTED] Sent: 10 September 2008 16:19 To: CF-Talk Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic) David, Everything in CF (starting with CFMX and partially before that) is an object that has a parent. For example, if I do the following: cfset x = 10/ I have created a member of the variables scope (variables is the object and x is the member). So I could do the following with x: cfoutput#x#/cfoutput cfoutput#variables.x#/cfoutput cfoutput#variables[x]#/cfoutput This is true of every scope in CF - application, variables, form, url, arguments, attributes, request, server, session. Each of these are objects with members. Why does cfoutput#x#/cfoutput work you ask? Because when CF sees a var that has no parent object specified it looks in the variables scope (followed by url and then form) and figures it out for you. This is done for convenience but the abstraction keeps you from understanding what is going on under the hood. -Mark ~| 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:312317 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
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:312318 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Adrian Lynch wrote: A little correction: cfoutput#variables[x]#/cfoutput should be: cfoutput#variables[x]#/cfoutput Adrian OR cfset x = x cfoutput#variable[x]#/cfoutput :) But yea, what does that really gain for you. ~| 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:312319 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
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
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
Right... And doh! Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 10:27 AM To: CF-Talk Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic) A little correction: cfoutput#variables[x]#/cfoutput should be: cfoutput#variables[x]#/cfoutput Adrian -Original Message- From: Mark Kruger [mailto:[EMAIL PROTECTED] Sent: 10 September 2008 16:19 To: CF-Talk Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic) David, Everything in CF (starting with CFMX and partially before that) is an object that has a parent. For example, if I do the following: cfset x = 10/ I have created a member of the variables scope (variables is the object and x is the member). So I could do the following with x: cfoutput#x#/cfoutput cfoutput#variables.x#/cfoutput cfoutput#variables[x]#/cfoutput This is true of every scope in CF - application, variables, form, url, arguments, attributes, request, server, session. Each of these are objects with members. Why does cfoutput#x#/cfoutput work you ask? Because when CF sees a var that has no parent object specified it looks in the variables scope (followed by url and then form) and figures it out for you. This is done for convenience but the abstraction keeps you from understanding what is going on under the hood. -Mark ~| 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:312321 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Thanx Adrian and Ian. That worked. First try even..That was the secret handshake I was looking for. ~G~ On Wed, Sep 10, 2008 at 11:25 AM, Ian Skinner [EMAIL PROTECTED] wrote: Gerald Guido wrote: cfset MyServiceObj = evaluate(Application.#arguments.MyTable#Service)/ cfset mystring = MyServiceObj.save#arguments.MyTable#(myBeanObj) / cfreturn evaluate(mystring) / Many TIA Well I think the first line could be... cfset MyServiceObe = Application[arguments.MyTable 'Service] I'm still mulling over what the next code does. ~| 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:312322 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
A bit off topic - but a warning. I seem to remember a bug with cfqueryparam and array syntax on structs. Ie cfqueryparam value=#form[key]# If I remember right, a single quote would end up throwing an error. I seem to remember this in 7.0.0, and it was probably fixed in an updater. I'm just throwing this out in case you see it. To get around it, I used a temp val. cfset rayrocksthefreeworld = form[key] cfqueryparam value=#rayrocksthefreeworld# On Wed, Sep 10, 2008 at 10:47 AM, Mark Kruger [EMAIL PROTECTED] wrote: Right... And doh! Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.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:312323 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
You people are just scary smart. At least I have my good looks to fall back on :) (I wish)... ~David _ See how Windows connects the people, information, and fun that are part of your life. http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/ ~| 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:312326 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
There is an order of precedence (which I don't remember offhand) that CF looks at when a variable isn't scoped. It goes down the list until it finds a variable with a value. Mark...I do have a question, with your cfoutput statements below...are you saying that those three would output the same? Lets assume x=2...wouldn't variables[x] return whatever the 2nd element is in that object (assuming it is stored as an array)? What if x=q...wouldn't that throw an error since the array sub(I forget the actual term) has to be numeric? Eric /*-Original Message- /*From: Mark Kruger [mailto:[EMAIL PROTECTED] /*Sent: Wednesday, September 10, 2008 10:19 AM /*To: CF-Talk /*Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse /*topic) /* /*David, /* /*Everything in CF (starting with CFMX and partially before that) is an /*object that has a parent. /* /* /*For example, if I do the following: /* /*cfset x = 10/ /* /*I have created a member of the variables scope (variables is the /*object and x is the member). /* /*So I could do the following with x: /* /*cfoutput#x#/cfoutput /* /*cfoutput#variables.x#/cfoutput /* /*cfoutput#variables[x]#/cfoutput /* /* /*This is true of every scope in CF - application, variables, form, url, /*arguments, attributes, request, server, session. Each of these are /*objects with members. /* /*Why does cfoutput#x#/cfoutput work you ask? Because when CF sees a var /*that has no parent object specified it looks in the variables scope /*(followed by url and then form) and figures it out for you. This is done /*for /*convenience but the abstraction keeps you from understanding what is going /*on under the hood. /* /*-Mark /* /* /* /* /*Mark A. Kruger, CFG, MCSE /*(402) 408-3733 ext 105 /*www.cfwebtools.com /*www.coldfusionmuse.com /*www.necfug.com /* /*-Original Message- /*From: David Moore, Jr. [mailto:[EMAIL PROTECTED] /*Sent: Wednesday, September 10, 2008 9:44 AM /*To: CF-Talk /*Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse /*topic) /* /*Adrian Wrote: /* /* SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' AND /* Contacts.#FORM.Field# = '#FORM[FORM.Field]#' ORDER BY /* Contacts.LastName /* /*What is the [] for. How would they be used. I have never used them at all. /*What is the protocal. Is that CF or SQL or... And then throw in some /*cfqueryparams. /*I am just starting to write in the cfqueryparams. That is a new one too. /* /*~David /*_ /*Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. /*http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog- /*cns!55 /*0F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 /* /* /* /* ~| 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:312327 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
lol Shouldn't that be: cfset x = x cfoutput#variable[variable.x]#/cfoutput /lol -Original Message- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 11:37 AM To: CF-Talk Subject: Re: How NOT to Evaluate (moved from cfset so not to confuse topic) Adrian Lynch wrote: A little correction: cfoutput#variables[x]#/cfoutput should be: cfoutput#variables[x]#/cfoutput Adrian OR cfset x = x cfoutput#variable[x]#/cfoutput :) But yea, what does that really gain for you. ~| 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:312328 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
Well, if you'll were trying to make it clearer - it's darker than pitch now. Smart - but confusing. Seriously. I'm, lost again. Let's just do this one: cfoutput query=getPhysicianSubTypes startrow=#Evaluate(start)# maxrows=#Evaluate(end)# and this one, which is from a tag I got of Adobe 2 days ago called cf_search_nextprevious: a href=#variables.FileName#?#variables.ExtraURLString#amp;#variables.strt_string#=#Evaluate(variables.strt + variables.show)##variables.layout_next#/a ~David lol Shouldn't that be: cfset x = x cfoutput#variable[variable.x]#/cfoutput /lol Adrian Lynch wrote: A little correction: cfoutput#variables[x]#/cfoutput should be: cfoutput#variables[x]#/cfoutput _ See how Windows Mobile brings your life togetherat home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312329 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Ok... Thanx All. Now this one is kicking my butt. cfset mystring = MyServiceObj.delete#arguments.MyTable#(#arguments.MyPK# = myBeanObj.get#arguments.MyPK#()) / cfreturn evaluate(mystring) / Using tblUsers it would render this cfset MyServiceObj.deleteTableUsers (UserID = myBeanObj.getUserID()) / Is this possible with out using CFinvoke or Evaluate? Sorry about this. One of the joys of having written language LD. Syntax kicks my ass. ~G~ On Wed, Sep 10, 2008 at 11:38 AM, Adrian Lynch [EMAIL PROTECTED]wrote: 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:312330 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
If it's the arguments that's causing trouble, try this: [Do the cfinvoke thing here to get the user ID] cfset args = StructNew() cfset args[arguments.MyPK] = userID Then pass that structure into the method: cfset MyServiceObj.deleteTableUsers(argumentCollection = args) Adrian -Original Message- From: Gerald Guido [mailto:[EMAIL PROTECTED] Sent: 10 September 2008 17:30 To: CF-Talk Subject: Re: How NOT to Evaluate (moved from cfset so not to confuse topic) Ok... Thanx All. Now this one is kicking my butt. cfset mystring = MyServiceObj.delete#arguments.MyTable#(#arguments.MyPK# = myBeanObj.get#arguments.MyPK#()) / cfreturn evaluate(mystring) / Using tblUsers it would render this cfset MyServiceObj.deleteTableUsers (UserID = myBeanObj.getUserID()) / Is this possible with out using CFinvoke or Evaluate? Sorry about this. One of the joys of having written language LD. Syntax kicks my ass. ~G~ On Wed, Sep 10, 2008 at 11:38 AM, Adrian Lynch [EMAIL PROTECTED]wrote: 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:312331 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
What's wrong with cfinvoke? Any reason you don't want to use that? On Wed, Sep 10, 2008 at 11:29 AM, Gerald Guido [EMAIL PROTECTED] wrote: Ok... Thanx All. Now this one is kicking my butt. cfset mystring = MyServiceObj.delete#arguments.MyTable#(#arguments.MyPK# = myBeanObj.get#arguments.MyPK#()) / cfreturn evaluate(mystring) / Using tblUsers it would render this cfset MyServiceObj.deleteTableUsers (UserID = myBeanObj.getUserID()) / Is this possible with out using CFinvoke or Evaluate? Sorry about this. One of the joys of having written language LD. Syntax kicks my ass. ~| 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:312332 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
What's wrong with cfinvoke? Any reason you don't want to use that? No good reason... other than I want to have it all be in CFscript when I am done. More of a personal confronting my demons and pushing my limits thing than anything else. Kinda like your code contests. Sorry if this is using too many cycles on the behalf of others. Thanx ~G~ On Wed, Sep 10, 2008 at 12:57 PM, Raymond Camden [EMAIL PROTECTED] wrote: What's wrong with cfinvoke? Any reason you don't want to use that? On Wed, Sep 10, 2008 at 11:29 AM, Gerald Guido [EMAIL PROTECTED] wrote: Ok... Thanx All. Now this one is kicking my butt. cfset mystring = MyServiceObj.delete#arguments.MyTable#(#arguments.MyPK# = myBeanObj.get#arguments.MyPK#()) / cfreturn evaluate(mystring) / Using tblUsers it would render this cfset MyServiceObj.deleteTableUsers (UserID = myBeanObj.getUserID()) / Is this possible with out using CFinvoke or Evaluate? Sorry about this. One of the joys of having written language LD. Syntax kicks my ass. ~| 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:312334 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Untested but should work: cfquery name=getPhysicianRecords datasource=#DSN# SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' cfif Len(form.field) AND StructKeyExists(form,form.field) AND Contacts.#FORM.Field# = '#Trim(form[form.field])#' cfelse 1 = 0 /cfelse ORDER BY Contacts.LastName /cfquery CF evaluates inside-out so form.field is resolved (doesn't need quotes because its a variable) to a string that is used in the form struct to refer to that particular key. The rest of the code I added in is for error handling and it should probably go in a cfqueryparam as well. Cheers, Judah On Wed, Sep 10, 2008 at 7:03 AM, David Moore, Jr. [EMAIL PROTECTED]wrote: Ray wrote: As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. How then would you approach the following without Evaluate, because it was the only way I could get it to work: (oh, let the fun begin, the shame. I probably committed at least 7 deadly sins alone. And yes, I am using Access. Moan. Laughter.) In my ever growing need to expand my knowledge base (and look less like an idiot to this list) HELP? It's a query that accepts information from a Search field to run a query. cfquery name=getPhysicianRecords datasource=#DSN#SELECT *FROM ContactsWHERE Contacts.ContactType = 'Physician' AND Contacts.#FORM.Field# = '#Evaluate(FORM.#FORM.Field#)#'ORDER BY Contacts.LastName~David ~| 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:312335 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
Judah wrote: Untested but should work: cfquery name=getPhysicianRecords datasource=#DSN# SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' cfif Len(form.field) AND StructKeyExists(form,form.field) AND Contacts.#FORM.Field# = '#Trim(form[form.field])#' cfelse 1 = 0 /cfelse ORDER BY Contacts.LastName /cfquery Showing my ignorance again, but it is already showing so why not. What does the 1 = 0 do? ~David _ Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312336 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
cfinvoke component=#myService# method=save#ARGUMENTS.myTable# returnvariable=aVarIfYouWantOne cfinvokeargument name=myBeanObj value=#myBeanObj# /cfinvoke I found on one of Ben Nadel's blog recently that you can (at least with CF8 and the latest updater) use 1 as the name of the argument. cfinvoke component=#myService# method=save#ARGUMENTS.myTable# cfinvokeargument name=1 value=#myBeanObj# /cfinvoke Which might be helpful if different functions in that object have different names for the first argument. It didn't always work in my environment at the time apparently because of a bug with cf-script-based functions in CF8 that was fixed in the updater, but I hadn't installed it yet. I haven't tried it on CF7, but my guess would be the bug exists there also. But if you're not creating functions with cfscript then you won't run into that issue. -- s. isaac dealey ^ new epoch isn't it time for a change? ph: 781.769.0723 http://onTap.riaforge.org/blog ~| 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:312339 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Showing my ignorance again, but it is already showing so why not. What does the 1 = 0 do? Evaluates to false and returns no records in the query. -- s. isaac dealey ^ new epoch isn't it time for a change? ph: 781.769.0723 http://onTap.riaforge.org/blog ~| 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:312341 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: How NOT to Evaluate (moved from cfset so not to confuse topic)
Ah, sorry, didn't explain fully. I did a StructKeyExists and a Len to make sure that the field you are going to evaluate really exists in the form. If it doesn't, you don't want your cfquery to throw a gnarly error (most likely) so if the assertion is false, the WHERE clause becomes WHERE 1 = 0 which is always false so the query completes and returns 0 records. Alternatively, you could wrap your query in a try/catch and catch any db errors and display them back to the user telling them that they forgot to put in a field to search on. Cheers, Judah On Wed, Sep 10, 2008 at 10:12 AM, David Moore, Jr. [EMAIL PROTECTED]wrote: Judah wrote: Untested but should work: cfquery name=getPhysicianRecords datasource=#DSN# SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' cfif Len(form.field) AND StructKeyExists(form,form.field) AND Contacts.#FORM.Field# = '#Trim(form[form.field])#' cfelse 1 = 0 /cfelse ORDER BY Contacts.LastName /cfquery Showing my ignorance again, but it is already showing so why not. What does the 1 = 0 do? ~David _ Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312342 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
Now I am having one of those v8Aha!/v8 moments. Thank you... ~David Judah wrote: Ah, sorry, didn't explain fully. I did a StructKeyExists and a Len to make sure that the field you are going to evaluate really exists in the form. If it doesn't, you don't want your cfquery to throw a gnarly error (most likely) so if the assertion is false, the WHERE clause becomes WHERE 1 = 0 which is always false so the query completes and returns 0 records. Alternatively, you could wrap your query in a try/catch and catch any db errors and display them back to the user telling them that they forgot to put in a field to search on. Cheers, Judah _ Stay up to date on your PC, the Web, and your mobile phone with Windows Live. http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/ ~| 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:312349 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
Well according to a quick (iterative) test on CF 8.0.1 evaluate seems to be about 5 times slower than the array notation. Of course, we're still talking about the difference between 1 ms and 5 ms's. I think that is very good information to know and use, but frankly I would agree that readability should take precedence until you run into a page doing enough processing to actually matter. I think the whole witch-hunt mentality is a little obtuse. :) ~Brad - Original Message - From: Raymond Camden [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Wednesday, September 10, 2008 8:33 AM Subject: Re: using dynamic variable in cfset statement As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. ~| 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:312356 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
I just consider Evaluate to be sloppy coding. It is (almost) never needed as it basically tells coldfusion to do something it already is doing: look at this and see if its a variable. It is by no means the worst thing in the world but to the extent that you can cut it out of your code, I think you do yourself a favor by coding more cleanly (and increasing execution efficiency even if only a little). Judah On Wed, Sep 10, 2008 at 2:16 PM, Brad Wood [EMAIL PROTECTED] wrote: Well according to a quick (iterative) test on CF 8.0.1 evaluate seems to be about 5 times slower than the array notation. Of course, we're still talking about the difference between 1 ms and 5 ms's. I think that is very good information to know and use, but frankly I would agree that readability should take precedence until you run into a page doing enough processing to actually matter. I think the whole witch-hunt mentality is a little obtuse. :) ~Brad - Original Message - From: Raymond Camden [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Wednesday, September 10, 2008 8:33 AM Subject: Re: using dynamic variable in cfset statement As someone who used to always pounce on folks for using evaluate, I believe I remember reading recently a blog entry from an Adobian that points out that evaluate is not nearly as slow as it used to be. Now when I recommend against Evaluate I do so on readability terms rather than performance. For almost every use of evaluate I see in the field, the code can be rewritten in a cleaner, easier to understand manner. ~| 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:312359 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How NOT to Evaluate (moved from cfset so not to confuse topic)
Eric, Yes.. (and sorry for the delay in answering)... You are correct... It was a typo. It should have read cfoutput#variables[x]#/cfoutput ... My bad :) Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Eric Roberts [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 11:19 AM To: CF-Talk Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic) There is an order of precedence (which I don't remember offhand) that CF looks at when a variable isn't scoped. It goes down the list until it finds a variable with a value. Mark...I do have a question, with your cfoutput statements below...are you saying that those three would output the same? Lets assume x=2...wouldn't variables[x] return whatever the 2nd element is in that object (assuming it is stored as an array)? What if x=q...wouldn't that throw an error since the array sub(I forget the actual term) has to be numeric? Eric /*-Original Message- /*From: Mark Kruger [mailto:[EMAIL PROTECTED] /*Sent: Wednesday, September 10, 2008 10:19 AM /*To: CF-Talk /*Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse /*topic) /* /*David, /* /*Everything in CF (starting with CFMX and partially before that) is an /*object that has a parent. /* /* /*For example, if I do the following: /* /*cfset x = 10/ /* /*I have created a member of the variables scope (variables is the /*object and x is the member). /* /*So I could do the following with x: /* /*cfoutput#x#/cfoutput /* /*cfoutput#variables.x#/cfoutput /* /*cfoutput#variables[x]#/cfoutput /* /* /*This is true of every scope in CF - application, variables, form, url, /*arguments, attributes, request, server, session. Each of these are /*objects with members. /* /*Why does cfoutput#x#/cfoutput work you ask? Because when CF sees a var /*that has no parent object specified it looks in the variables scope /*(followed by url and then form) and figures it out for you. This is done /*for /*convenience but the abstraction keeps you from understanding what is going /*on under the hood. /* /*-Mark /* /* /* /* /*Mark A. Kruger, CFG, MCSE /*(402) 408-3733 ext 105 /*www.cfwebtools.com /*www.coldfusionmuse.com /*www.necfug.com /* /*-Original Message- /*From: David Moore, Jr. [mailto:[EMAIL PROTECTED] /*Sent: Wednesday, September 10, 2008 9:44 AM /*To: CF-Talk /*Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse /*topic) /* /*Adrian Wrote: /* /* SELECT * FROM Contacts WHERE Contacts.ContactType = 'Physician' AND /* Contacts.#FORM.Field# = '#FORM[FORM.Field]#' ORDER BY /* Contacts.LastName /* /*What is the [] for. How would they be used. I have never used them at all. /*What is the protocal. Is that CF or SQL or... And then throw in some /*cfqueryparams. /*I am just starting to write in the cfqueryparams. That is a new one too. /* /*~David /*_ /*Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. /*http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog- /*cns!55 /*0F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 /* /* /* /* ~| 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:312360 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
using dynamic variable in cfset statement
Why does this fail inside a cfoutput loop over a query: cfset application.#appconfig.code_name# = '#appconfig.code_value#' It generates this message: A CFML variable name cannot end with a . character. The variable application. ends with a . character. You must supply an additional structure key or delete the . character. ~| 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:312257 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
try cfset application[appconfig.code_name] = appconfig.code_value / On Tue, Sep 9, 2008 at 1:53 PM, Wally Randall [EMAIL PROTECTED]wrote: Why does this fail inside a cfoutput loop over a query: cfset application.#appconfig.code_name# = '#appconfig.code_value#' It generates this message: A CFML variable name cannot end with a . character. The variable application. ends with a . character. You must supply an additional structure key or delete the . character. ~| 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:312258 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
The variable application. ends with a . character. This looks to me like appconfig.code_name is an empty string. ~| 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:312259 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
Why does this fail inside a cfoutput loop over a query: cfset application.#appconfig.code_name# = '#appconfig.code_value#' It sounds like one of your code_name values is blank or null, resulting in an invalid variable name. -- Justin Scott, http://www.tlson.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:312260 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
Charlie has the idea. It's because you are referring to a variable contained within an structure and doing dynamic dot notation has it's issues and will not work in this case. -Pat On Tue, Sep 9, 2008 at 1:57 PM, Charlie Griefer [EMAIL PROTECTED]wrote: try cfset application[appconfig.code_name] = appconfig.code_value / On Tue, Sep 9, 2008 at 1:53 PM, Wally Randall [EMAIL PROTECTED] wrote: Why does this fail inside a cfoutput loop over a query: cfset application.#appconfig.code_name# = '#appconfig.code_value#' It generates this message: A CFML variable name cannot end with a . character. The variable application. ends with a . character. You must supply an additional structure key or delete the . character. ~| 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:312261 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
The variable application. ends with a . character. This looks to me like appconfig.code_name is an empty string. It is not an empty string. Also, the [] is an invalid constrict in coldfusion. ~| 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:312262 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: using dynamic variable in cfset statement
Why does this fail inside a cfoutput loop over a query: cfset application.#appconfig.code_name# = '#appconfig.code_value#' It has nothing to do with the query. To set a variable whose name isn't known until runtime, you have three options: 1. The syntax in Charlie's email - my preference out of the three 2. cfset application.#whatever# = whateverVal 3. cfset SetVariable(application.#whatever#, whateverVal) Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| 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:312263 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
On Tue, Sep 9, 2008 at 2:01 PM, Wally Randall [EMAIL PROTECTED]wrote: Also, the [] is an invalid constrict in coldfusion. could you elaborate on that please? -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. ~| 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:312264 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: using dynamic variable in cfset statement
Also, the [] is an invalid constrict in coldfusion. That hasn't been true since CF 4. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| 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:312265 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
So are you saying: cfset application[appconfig.code_name] = '#appconfig.code_value#' or even cfset application.#appconfig.code_name# = '#appconfig.code_value#' does not work? The second example with quotes around the set variable should also work I believe. -Pat On Tue, Sep 9, 2008 at 2:01 PM, Wally Randall [EMAIL PROTECTED]wrote: The variable application. ends with a . character. This looks to me like appconfig.code_name is an empty string. It is not an empty string. Also, the [] is an invalid constrict in coldfusion. ~| 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:312266 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
Not in this case. The []'s will work. On 9/9/08, Wally Randall [EMAIL PROTECTED] wrote: The variable application. ends with a . character. This looks to me like appconfig.code_name is an empty string. It is not an empty string. Also, the [] is an invalid constrict in coldfusion. ~| 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:312268 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
Wally Randall wrote: Why does this fail inside a cfoutput loop over a query: application. is an illegal variable name. To do this type of thing you need to use array notation. cfset application[appconfig.code_name] = appconfig.code_value ~| 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:312267 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: using dynamic variable in cfset statement
Would something like this work? cfset Evaluate(application.#appconfig.code_name#) = '#appconfig.code_value#' ~ David Moore _ Get more out of the Web. Learn 10 hidden secrets of Windows Live. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312269 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
Ouch! Evaluate On Tue, Sep 9, 2008 at 2:15 PM, David Moore, Jr. [EMAIL PROTECTED]wrote: Would something like this work? cfset Evaluate(application.#appconfig.code_name#) = '#appconfig.code_value#' ~ David Moore _ Get more out of the Web. Learn 10 hidden secrets of Windows Live. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312270 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
Also, the [] is an invalid constrict in coldfusion. well, if appconfig.code_name is an empty string, then [appconfig.code_name] will be equivalent to [], which is an invalid constrict in coldfusion. If I were you, I'll really make sure appconfig.code_name is not an empty string ;-) Just try this: CFOUTPUT[#appconfig.code_name#]/CFOUTPUT ~| 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:312271 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
hehe :) On Tue, Sep 9, 2008 at 2:18 PM, Patrick Santora [EMAIL PROTECTED] wrote: Ouch! Evaluate On Tue, Sep 9, 2008 at 2:15 PM, David Moore, Jr. [EMAIL PROTECTED] wrote: Would something like this work? cfset Evaluate(application.#appconfig.code_name#) = '#appconfig.code_value#' ~ David Moore _ Get more out of the Web. Learn 10 hidden secrets of Windows Live. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008 http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312272 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: using dynamic variable in cfset statement
I just love giving you guys something to laugh at ... Rag the newbie... It's OK. At least I am learning, and trying. :) hehe :) Ouch! Evaluate _ See how Windows Mobile brings your life togetherat home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312273 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
It's sometimes the best and fastest way to learn :-). Evaluate works, it's just not really recommended Ouch. ;-) On Tue, Sep 9, 2008 at 2:27 PM, David Moore, Jr. [EMAIL PROTECTED]wrote: I just love giving you guys something to laugh at ... Rag the newbie... It's OK. At least I am learning, and trying. :) hehe :) Ouch! Evaluate _ See how Windows Mobile brings your life togetherat home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312274 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
On Tue, Sep 9, 2008 at 4:53 PM, Wally Randall [EMAIL PROTECTED]wrote: Why does this fail inside a cfoutput loop over a query: cfset application.#appconfig.code_name# = '#appconfig.code_value#' It generates this message: A CFML variable name cannot end with a . character. The variable application. ends with a . character. You must supply an additional structure key or delete the . character. Just throwing something out here since you are mentioning that you are doing this by looping over a query. You could set all of those appconfig variables by looping over the column names. cfloop index=ColumnName list=#appconfig.ColumnList# cfset APPLICATION.appconfig.#ColumnName# = appconfig[#ColumnName#] /cfloop ~| 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:312275 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
hey i was laughing at patrick laughing at you, not laughing at you directly, so it's ok :) serious face there's probably not one of us on this list that didn't used to use evaluate() before being taught to look at other alternatives (and i'm sure some who still do use it). it's all good. participating is how you learn. keep doing what you're doing. /serious face :) On Tue, Sep 9, 2008 at 2:27 PM, David Moore, Jr. [EMAIL PROTECTED]wrote: I just love giving you guys something to laugh at ... Rag the newbie... It's OK. At least I am learning, and trying. :) hehe :) Ouch! Evaluate _ See how Windows Mobile brings your life togetherat home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312276 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: using dynamic variable in cfset statement
laughingIt's kind of like a right of passage/laughing It just looks to tempting to use sometimes :-) Well said Charlie. On Tue, Sep 9, 2008 at 2:33 PM, Charlie Griefer [EMAIL PROTECTED]wrote: hey i was laughing at patrick laughing at you, not laughing at you directly, so it's ok :) serious face there's probably not one of us on this list that didn't used to use evaluate() before being taught to look at other alternatives (and i'm sure some who still do use it). it's all good. participating is how you learn. keep doing what you're doing. /serious face :) On Tue, Sep 9, 2008 at 2:27 PM, David Moore, Jr. [EMAIL PROTECTED] wrote: I just love giving you guys something to laugh at ... Rag the newbie... It's OK. At least I am learning, and trying. :) hehe :) Ouch! Evaluate _ See how Windows Mobile brings your life togetherat home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312277 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: using dynamic variable in cfset statement
Pat wrote: It's sometimes the best and fastest way to learn :-). Evaluate works, it's just not really recommended Ouch. ;-) Yes. It's just painful to the character of ones soul. I didn't know that about Evaluate. Glad I do know that...now. I wish there was an asterisks next to code somewhere that says, here's some code, but don't use this. It's really BAD. It works, but you shouldn't use it I mean, why is it there if you are not supposed to use it. It's like Eve and the apple all over again... ~ David _ See how Windows Mobile brings your life togetherat home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312278 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: using dynamic variable in cfset statement
Casey Dougall wrote: cfloop index=ColumnName list=#appconfig.ColumnList# cfset APPLICATION.appconfig.#ColumnName# = appconfig[#ColumnName#] /cfloop Or the same thing with a few less pound signs and quotes. cfset Application['appconfig'][ColumnName] = appconfig[ColunName] Or to completely eliminate the loop, but then you will be working with a record set rather then a simple structure. cfset application.appconfig = appconfig ~| 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:312279 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: using dynamic variable in cfset statement
Charlie wrote: hey i was laughing at patrick laughing at you, not laughing at you directly, so it's ok :) Oh, I'm cool. I worked in Radio for 15 years as a DJ, so I don't expect a whole lot out of myself. I thought it was funny too. :) ~David _ Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ~| 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:312280 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: using dynamic variable in cfset statement
Yeah, but it never stops. We still laugh at Will T. every chance we get. ..:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com -Original Message- From: Patrick Santora [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 09, 2008 5:38 PM To: CF-Talk Subject: Re: using dynamic variable in cfset statement laughingIt's kind of like a right of passage/laughing It just looks to tempting to use sometimes :-) Well said Charlie. On Tue, Sep 9, 2008 at 2:33 PM, Charlie Griefer [EMAIL PROTECTED]wrote: hey i was laughing at patrick laughing at you, not laughing at you directly, so it's ok :) serious face there's probably not one of us on this list that didn't used to use evaluate() before being taught to look at other alternatives (and i'm sure some who still do use it). it's all good. participating is how you learn. keep doing what you're doing. /serious face :) On Tue, Sep 9, 2008 at 2:27 PM, David Moore, Jr. [EMAIL PROTECTED] wrote: I just love giving you guys something to laugh at ... Rag the newbie... It's OK. At least I am learning, and trying. :) hehe :) Ouch! Evaluate _ See how Windows Mobile brings your life together?at home, work, or on the go. http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ ~| 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:312281 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Conditional CFSET based on data in array
I've got a simple cart that stores items in an array. I keep a running total of the items in the cart looping through: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] /cfloop 4 is quantity of that item in the array. What I'd need is to have a running total of items, that does not include a certain item, based on the 8th element of the array where I store category. Something like: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] where session.cart[8} is not 22 /cfloop Is there a way to do this? I need a boost! -jeff ~| 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:312204 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Conditional CFSET based on data in array
On Mon, Sep 8, 2008 at 12:54 PM, Jeff F [EMAIL PROTECTED] wrote: I've got a simple cart that stores items in an array. I keep a running total of the items in the cart looping through: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] /cfloop 4 is quantity of that item in the array. What I'd need is to have a running total of items, that does not include a certain item, based on the 8th element of the array where I store category. Something like: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] where session.cart[8} is not 22 /cfloop there's probably a cleaner implementation, but this should work: cfloop collection=#session.cart# item=idx cfif session.cart[idx][8] is not 22 cfset numberOfItems = numberOfItems + session.cart[idx][4] / /cfif /cfloop -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. ~| 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:312206 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Conditional CFSET based on data in array
This seems to work: cfloop collection=#session.cart# item=i cfif session.cart[i][8] is not 22 cfset numberofitems = numberofitems + session.cart[i][4] /cfif /cfloop -Jeff I've got a simple cart that stores items in an array. I keep a running total of the items in the cart looping through: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] /cfloop 4 is quantity of that item in the array. What I'd need is to have a running total of items, that does not include a certain item, based on the 8th element of the array where I store category. Something like: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] where session.cart[8} is not 22 /cfloop Is there a way to do this? I need a boost! -jeff ~| 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:312207 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Conditional CFSET based on data in array
Without seeing more I can't offer much in the way of specific advice, but this approach seems like it could be refactored or changed in some way to make it less confusing and less dependent on the magic numbers 8 and 22. My initial take on this is that if you or anyone else has to maintain this later it's going to be difficult to figure out what is going on. If you care to post more you might get some additional feedback on the approach as a whole. Regards, Brian On Mon, Sep 8, 2008 at 3:54 PM, Jeff F [EMAIL PROTECTED] wrote: I've got a simple cart that stores items in an array. I keep a running total of the items in the cart looping through: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] /cfloop 4 is quantity of that item in the array. What I'd need is to have a running total of items, that does not include a certain item, based on the 8th element of the array where I store category. Something like: cfloop collection=#session.cart# item=i cfset numberofitems = numberofitems + session.cart[i][4] where session.cart[8} is not 22 /cfloop Is there a way to do this? I need a boost! -jeff ~| 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:312208 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Interesting results with setting variables - cfset vs. using a cfscript block
I had originally posted this on CF-Community, but I thought that these results were interesting enough that others would like to see them. I got into a discussion at my new job about creating variables by the cfset tag or via a variable assignment using cfscript. The consensus has been that when setting large blocks of variables using cfscript is faster than cfset. The reason that tags are slower is that when the template JITs, it adds extra libraries into the class. When you use cfscript,it uses fewer cftag libraries mentioned as Java import namespaces because the cfscript code is closer to the native Java and therefore requires less overhead (at least according to some blog postings I've read). Also, the tag named import also contains functionality the code may not be using. Therefore, you have thinner JITs and faster code. Or so I thought. Here's some code I wrote to test this, not that this is over a million iterations, a pretty unreal situation ordinarily: cfset iterations = 100/ cfscript start1 = getTickCount(); result=0; for(i=0;i lte #iterations#;i=i+1) { result=result+i; } end1 = getTickCount(); /cfscript cfset start2 = getTickCount() / cfset result2 = 0 / cfloop from=1 to=#iterations# index=j cfset result2=result2+j / /cfloop cfset end2 = getTickCount() / fieldset legendCFSCRIPT/legend pcfoutput#result#/cfoutputbr/ cfoutputExecution Time: #end1 - start1#ms/cfoutput/p /fieldset fieldsetlegendCFSET/legend pcfoutput#result2#/cfoutputbr/ cfoutputExecution Time: #end2 - start2#ms/cfoutput/p /fieldset Here are the results: CFSCRIPT total: 5050 Execution Time: 1472ms CFSET total: 5050 Execution Time: 947ms So am I missing something here? This was on a Windows XP box with service pack 2 installed (dell optiplex dual core with 2 gigs of ram). Its running the dev edition of CFMX 7.02 with cumulative hotfix 3 installed. I got similar results using Open BlueDragon on a MacBook with OSX 10.5.3. Generally these results go against what's commonly thought. However given that there was only about a half second difference over a million iterations, is it really an important difference? ~| 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:308445 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
You should read this, quite interesting (CF8 vs CF7 etc) : http://neilmiddleton.com/2007/07/01/cf-8-and-performance-comparisons/ Regards, Stephane ~| 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:308446 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
I ran your code a few times on my machine (XP Pro) and got varying results; sometimes the cfscript was faster, sometimes cfset. Try this code out instead, it performs a single test on both cfscript and cfset for each iteration and records a tally of the time taken for each - this spreads the test and reduces variance due to the varying state of the computers processor, etc. So far I always have cfscript as slightly faster: cfset iterations = 100/ cfset scriptTotal = 0 cfset cfsetTotal = 0 cfset scriptResult = 0 / cfset cfsetResult = 0 / cfloop from=1 to=#iterations# index=i cfset tick = getTickCount() cfset cfsetResult = cfsetResult + i / cfset cfsetTotal = cfsetTotal + (getTickCount() - tick) cfscript tick = getTickCount(); scriptResult = scriptResult + i; scriptTotal = scriptTotal + (getTickCount() - tick); /cfscript /cfloop fieldset legendCFSCRIPT/legend pcfoutput#scriptResult#/cfoutputbr/ cfoutputExecution Time: #scriptTotal#ms/cfoutput/p /fieldset fieldset legendCFSET/legend pcfoutput#cfsetResult#/cfoutputbr/ cfoutputExecution Time: #cfsetTotal#ms/cfoutput/p /fieldset Dominic 2008/7/2 Larry Lyons [EMAIL PROTECTED]: I had originally posted this on CF-Community, but I thought that these results were interesting enough that others would like to see them. I got into a discussion at my new job about creating variables by the cfset tag or via a variable assignment using cfscript. The consensus has been that when setting large blocks of variables using cfscript is faster than cfset. The reason that tags are slower is that when the template JITs, it adds extra libraries into the class. When you use cfscript,it uses fewer cftag libraries mentioned as Java import namespaces because the cfscript code is closer to the native Java and therefore requires less overhead (at least according to some blog postings I've read). Also, the tag named import also contains functionality the code may not be using. Therefore, you have thinner JITs and faster code. Or so I thought. Here's some code I wrote to test this, not that this is over a million iterations, a pretty unreal situation ordinarily: cfset iterations = 100/ cfscript start1 = getTickCount(); result=0; for(i=0;i lte #iterations#;i=i+1) { result=result+i; } end1 = getTickCount(); /cfscript cfset start2 = getTickCount() / cfset result2 = 0 / cfloop from=1 to=#iterations# index=j cfset result2=result2+j / /cfloop cfset end2 = getTickCount() / fieldset legendCFSCRIPT/legend pcfoutput#result#/cfoutputbr/ cfoutputExecution Time: #end1 - start1#ms/cfoutput/p /fieldset fieldsetlegendCFSET/legend pcfoutput#result2#/cfoutputbr/ cfoutputExecution Time: #end2 - start2#ms/cfoutput/p /fieldset Here are the results: CFSCRIPT total: 5050 Execution Time: 1472ms CFSET total: 5050 Execution Time: 947ms So am I missing something here? This was on a Windows XP box with service pack 2 installed (dell optiplex dual core with 2 gigs of ram). Its running the dev edition of CFMX 7.02 with cumulative hotfix 3 installed. I got similar results using Open BlueDragon on a MacBook with OSX 10.5.3. Generally these results go against what's commonly thought. However given that there was only about a half second difference over a million iterations, is it really an important difference? ~| 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:308447 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Interesting results with setting variables - cfset vs. using a cfscript block
I had originally posted this on CF-Community, but I thought that these results were interesting enough that others would like to see them. I got into a discussion at my new job about creating variables by the cfset tag or via a variable assignment using cfscript. I really hate these kinds of things. Don't take this as a personal attack - I certainly respect you, Larry, I know you're a smart guy. But these which is faster arguments end up the same as asking how many angels can dance on the head of a pin. The consensus has been that when setting large blocks of variables using cfscript is faster than cfset. The reason that tags are slower is that when the template JITs, it adds extra libraries into the class. When you use cfscript, it uses fewer cftag libraries mentioned as Java import namespaces because the cfscript code is closer to the native Java and therefore requires less overhead (at least according to some blog postings I've read). Also, the tag named import also contains functionality the code may not be using. Therefore, you have thinner JITs and faster code. Or so I thought. The consensus for these sorts of questions, if you can call it a consensus, is usually derived from a common-sense understanding of how things work. This approach is very appealing, because it lets you predict how something should behave. Unfortunately, this understanding is often completely wrong. It sounds reasonable enough, but is not based on actual observation and testing. Or, it's based on an implementation detail that changes over versions. Now, even according to the above description, there shouldn't be much difference between the two, because if you're replacing exactly one tag with a CFSCRIPT block, there would only be one library imported; the one for CFSET. And, there's no reason to believe that there's more unused functionality in a CFSET than a CFSCRIPT. But again, this interpretation I've just made is based on a common-sense understanding of how things work, and could very well be completely wrong, or different across different versions of CF. Generally these results go against what's commonly thought. However given that there was only about a half second difference over a million iterations, is it really an important difference? No, it isn't. And, even if it was, it could be completely different in other versions. It could be faster one way in one version, and faster the other way in other versions. Finally, the only way to truly identify whether something's a bottleneck is to test in parallel - load testing - rather than in serial. One thing repeated a million times in a single script almost always performs differently than a million scripts doing that one thing. And really finally, the vast majority of these which is faster things are completely insignificant in the overall performance of the application. The time spent writing your code to conform to the current belief about which is faster would be better spent optimizing database interaction, or caching, or asynchronous processing - things which will definitely make your application perform better. I'm not addressing this last point at you directly; I just see a lot of applications where a lot of effort has been spent on insignificant items like this, while the big honking query right in the same program does a table scan as a result of an unindexed column. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| 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:308450 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
Note that 1º according to the docs, GetTickCount() returns a string representation of the system time, not the time spent on the CF code. The CF server is running in a time shared environment, so the system time is not really representative of the execution time. 2º There is a huge difference between what fellow developers think how things should be logically in theory and how they really are in practice ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| 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:308456 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
Stephane Vantroyen wrote: You should read this, quite interesting (CF8 vs CF7 etc) : http://neilmiddleton.com/2007/07/01/cf-8-and-performance-comparisons/ My guess is that a lot (most?) of the runtime difference between CF7 and 8 is down to the JVM; Java 6 is faster than 5 and a *lot* faster than 4. FWIW, we're running both CF7 and 8. and have run 7 with (Sun) Java 6 pretty much since it released, without any problems at all: I'd guess that macradobe warnings on that are mostly to cover themselves. -- Regards, Pete Jordan Horus Web Engineering Ltd http://www.webhorus.net/ phone: +44 1275 543971 mobile: +44 7973 725120 ~| 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:308463 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
I had originally posted this on CF-Community, but I thought that these results were interesting enough that others would like to see them. I got into a discussion at my new job about creating variables by the cfset tag or via a variable assignment using cfscript. I really hate these kinds of things. Don't take this as a personal attack - I certainly respect you, Larry, I know you're a smart guy. But these which is faster arguments end up the same as asking how many angels can dance on the head of a pin. No problem, just genuinely curious about some results. btw the answer is 42. The consensus for these sorts of questions, if you can call it a consensus, is usually derived from a common-sense understanding of how things work. This approach is very appealing, because it lets you predict how something should behave. Unfortunately, this understanding is often completely wrong. It sounds reasonable enough, but is not based on actual observation and testing. Or, it's based on an implementation detail that changes over versions. Now, even according to the above description, there shouldn't be much difference between the two, because if you're replacing exactly one tag with a CFSCRIPT block, there would only be one library imported; the one for CFSET. And, there's no reason to believe that there's more unused functionality in a CFSET than a CFSCRIPT. But again, this interpretation I've just made is based on a common-sense understanding of how things work, and could very well be completely wrong, or different across different versions of CF. Generally these results go against what's commonly thought. However given that there was only about a half second difference over a million iterations, is it really an important difference? No, it isn't. And, even if it was, it could be completely different in other versions. It could be faster one way in one version, and faster the other way in other versions. Finally, the only way to truly identify whether something's a bottleneck is to test in parallel - load testing - rather than in serial. One thing repeated a million times in a single script almost always performs differently than a million scripts doing that one thing. And really finally, the vast majority of these which is faster things are completely insignificant in the overall performance of the application. The time spent writing your code to conform to the current belief about which is faster would be better spent optimizing database interaction, or caching, or asynchronous processing - things which will definitely make your application perform better. I'm not addressing this last point at you directly; I just see a lot of applications where a lot of effort has been spent on insignificant items like this, while the big honking query right in the same program does a table scan as a result of an unindexed column. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ thanks Dave you've helped a lot. I was thinking that the next set will be load testing. You'v ejust confirmed that form me. ~| 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:308480 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
thanks dominic, I ran your code and the results between setting variable blocks with cfscript or using cfset varied from trial to trial. Some times cfscript was faster, other times cfset. Anyhow in a nutshell it confirms my initial idea, that it isn't really a major issue. In the end it depends on personal style, readability and other user factors as to which is preferred when setting large blocks of variables.. regards, larry I ran your code a few times on my machine (XP Pro) and got varying results; sometimes the cfscript was faster, sometimes cfset. Try this code out instead, it performs a single test on both cfscript and cfset for each iteration and records a tally of the time taken for each - this spreads the test and reduces variance due to the varying state of the computers processor, etc. So far I always have cfscript as slightly faster: cfset iterations = 100/ cfset scriptTotal = 0 cfset cfsetTotal = 0 cfset scriptResult = 0 / cfset cfsetResult = 0 / cfloop from=1 to=#iterations# index=i cfset tick = getTickCount() cfset cfsetResult = cfsetResult + i / cfset cfsetTotal = cfsetTotal + (getTickCount() - tick) cfscript tick = getTickCount(); scriptResult = scriptResult + i; scriptTotal = scriptTotal + (getTickCount() - tick); /cfscript /cfloop fieldset legendCFSCRIPT/legend pcfoutput#scriptResult#/cfoutputbr/ cfoutputExecution Time: #scriptTotal#ms/cfoutput/p /fieldset fieldset legendCFSET/legend pcfoutput#cfsetResult#/cfoutputbr/ cfoutputExecution Time: #cfsetTotal#ms/cfoutput/p /fieldset Dominic ~| 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:308481 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
In the end it depends on personal style, readability and other user factors as to which is preferred when setting large blocks of variables.. Yes absolutely ;) Dominic 2008/7/2 Larry Lyons [EMAIL PROTECTED]: thanks dominic, I ran your code and the results between setting variable blocks with cfscript or using cfset varied from trial to trial. Some times cfscript was faster, other times cfset. Anyhow in a nutshell it confirms my initial idea, that it isn't really a major issue. In the end it depends on personal style, readability and other user factors as to which is preferred when setting large blocks of variables.. regards, larry I ran your code a few times on my machine (XP Pro) and got varying results; sometimes the cfscript was faster, sometimes cfset. Try this code out instead, it performs a single test on both cfscript and cfset for each iteration and records a tally of the time taken for each - this spreads the test and reduces variance due to the varying state of the computers processor, etc. So far I always have cfscript as slightly faster: cfset iterations = 100/ cfset scriptTotal = 0 cfset cfsetTotal = 0 cfset scriptResult = 0 / cfset cfsetResult = 0 / cfloop from=1 to=#iterations# index=i cfset tick = getTickCount() cfset cfsetResult = cfsetResult + i / cfset cfsetTotal = cfsetTotal + (getTickCount() - tick) cfscript tick = getTickCount(); scriptResult = scriptResult + i; scriptTotal = scriptTotal + (getTickCount() - tick); /cfscript /cfloop fieldset legendCFSCRIPT/legend pcfoutput#scriptResult#/cfoutputbr/ cfoutputExecution Time: #scriptTotal#ms/cfoutput/p /fieldset fieldset legendCFSET/legend pcfoutput#cfsetResult#/cfoutputbr/ cfoutputExecution Time: #cfsetTotal#ms/cfoutput/p /fieldset Dominic ~| 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:308482 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Interesting results with setting variables - cfset vs. using a cfscript block
 btw the answer is 42. Nopethat's the answer to life, the universe, and everything ;-) - Bryan Stevenson B.Comm. VP Director of E-Commerce Development Electric Edge Systems Group Inc. phone: 250.480.0642 fax: 250.480.1264 cell: 250.920.8830 e-mail: [EMAIL PROTECTED] web: www.electricedgesystems.com Notice: This message, including any attachments, is confidential and may contain information that is privileged or exempt from disclosure. It is intended only for the person to whom it is addressed unless expressly authorized otherwise by the sender. If you are not an authorized recipient, please notify the sender immediately and permanently destroy all copies of this message and attachments. ~| 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:308484 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Problem using cfset inside cffunction
I am attempting to use cffunction to query a database and then cfset the returned variables to a new names. I get the following error when attempting to access the page. Local variable givenname on line 19 must be grouped at the top of the function body. Here's my function that appears on my .cfc page: cfldap action=query name=GetIDS start=ou=ple,o=blah.com filter=id=#userID# attributes=givenname,sn,mail,dbaddress,dbcity,dbstate,dbzipcode,homephone server=ds.blah.com username=uid=asdf,ou=ReadOnly,o=blah.com password=password cfset var givenname = First_name cfset var sn = Last_Name cfset var mail = Addr cfset var dbaddress = ADDRESS cfset var dbcity = City cfset var dbstate = State cfset var dbzipcode = ZIP cfset var homephone = PHONE cfreturn GetIDS /cffunction What am I doing wrong? Is it possible to use cfset inside of a cffunction? Thanks! John ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278099 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Problem using cfset inside cffunction
you have to place your var scoped variables at the top of the function. in this case, you'd do something like: cfset var givenname = / cfset var sn = / cfset var mail = / (etc) above your cfldap call. On 5/14/07, John P [EMAIL PROTECTED] wrote: I am attempting to use cffunction to query a database and then cfset the returned variables to a new names. I get the following error when attempting to access the page. Local variable givenname on line 19 must be grouped at the top of the function body. Here's my function that appears on my .cfc page: cfldap action=query name=GetIDS start=ou=ple,o=blah.com filter=id=#userID# attributes=givenname,sn,mail,dbaddress,dbcity,dbstate,dbzipcode,homephone server=ds.blah.com username=uid=asdf,ou=ReadOnly,o=blah.com password=password cfset var givenname = First_name cfset var sn = Last_Name cfset var mail = Addr cfset var dbaddress = ADDRESS cfset var dbcity = City cfset var dbstate = State cfset var dbzipcode = ZIP cfset var homephone = PHONE cfreturn GetIDS /cffunction What am I doing wrong? Is it possible to use cfset inside of a cffunction? Thanks! John ~| 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:278100 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Problem using cfset inside cffunction
Great, thanks Charlie. you have to place your var scoped variables at the top of the function. in this case, you'd do something like: cfset var givenname = / cfset var sn = / cfset var mail = / (etc) above your cfldap call. On 5/14/07, John P [EMAIL PROTECTED] wrote: ~| 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:278103 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Problem using cfset inside cffunction
It would be nice that you could var them anywhere in the function, oh well. On 5/15/07, John P [EMAIL PROTECTED] wrote: Great, thanks Charlie. you have to place your var scoped variables at the top of the function. in this case, you'd do something like: cfset var givenname = / cfset var sn = / cfset var mail = / (etc) above your cfldap call. On 5/14/07, John P [EMAIL PROTECTED] wrote: ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278116 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Problem using cfset inside cffunction
Railo and I guess Bluedragon allow var's everywhere... -- Greetings / Grüsse Gert Franz Customer Care Railo Technologies GmbH [EMAIL PROTECTED] www.railo.ch Join our Mailing List / Treten Sie unserer Mailingliste bei: deutsch: http://de.groups.yahoo.com/group/railo/ english: http://groups.yahoo.com/group/railo_talk/ Andrew Scott schrieb: It would be nice that you could var them anywhere in the function, oh well. On 5/15/07, John P [EMAIL PROTECTED] wrote: Great, thanks Charlie. you have to place your var scoped variables at the top of the function. in this case, you'd do something like: cfset var givenname = / cfset var sn = / cfset var mail = / (etc) above your cfldap call. On 5/14/07, John P [EMAIL PROTECTED] wrote: ~| 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:278118 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CFset problem
Your select statement will always return 1 row, and it will either contain the max number, or So, use: cfquery name=qryHighestNum datasource=ocreodsn Select Max(ReqNum) as HighestNumber from PrintingReq /cfquery cfset NextReqNumber = val(qryHighestNum.HighestNumber) + 1 No need for a cfif, since val() returns 0 -- Pat ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http: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:268232 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4