Re: cfscript question
On Tue, Aug 26, 2008 at 10:45 AM, Scott Stewart [EMAIL PROTECTED]wrote: Is it possible to do a query output loop in cfscript using something other than WriteOutput? obvious question is... why? :) for (i=1; i lt queryname.recordcount; i=i+1) { // you can pretty that up a bit if you're on CF8 writeOutput(queryname.columnName[i] br /); } why won't writeOutput work for you? what are you trying to do that writeoutput isn't the solution? -- A byte walks into a bar and orders a pint. Bartender asks him What's wrong? Byte says Parity error. Bartender nods and says Yeah, I thought you looked a bit off. ~| 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:311606 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cfscript question
Are you wishing for your function to return the generated content as a return variable as opposed to directly outputting to the page buffer? If so, you can concatenate strings together and then return the string at the end of the function. I'm not really sure where you are going with this though. If I am writing code that is outputting HTML etc, I usually do it in tags because that is what makes the most sense. I generally reserve cfscript for logic that doesn't involve output. ~Brad - Original Message - From: Scott Stewart [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Tuesday, August 26, 2008 12:45 PM Subject: cfscript question Is it possible to do a query output loop in cfscript using something other than WriteOutput? ~| 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:311608 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cfscript question
trying to make sense out of some screwy logic that someone else did although I'm about ready to rewrite it with tags... Charlie Griefer wrote: On Tue, Aug 26, 2008 at 10:45 AM, Scott Stewart [EMAIL PROTECTED]wrote: Is it possible to do a query output loop in cfscript using something other than WriteOutput? obvious question is... why? :) for (i=1; i lt queryname.recordcount; i=i+1) { // you can pretty that up a bit if you're on CF8 writeOutput(queryname.columnName[i] br /); } why won't writeOutput work for you? what are you trying to do that writeoutput isn't the solution? -- Scott Stewart ColdFusion Developer Office of Research Information Systems Research amp; Economic Development University of North Carolina at Chapel Hill Phone:(919)843-2408 Fax: (919)962-3600 Email: [EMAIL PROTECTED] ~| 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:311609 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: cfscript question
nope, I need to populate a function call based on another query Brad Wood wrote: Are you wishing for your function to return the generated content as a return variable as opposed to directly outputting to the page buffer? If so, you can concatenate strings together and then return the string at the end of the function. I'm not really sure where you are going with this though. If I am writing code that is outputting HTML etc, I usually do it in tags because that is what makes the most sense. I generally reserve cfscript for logic that doesn't involve output. ~Brad - Original Message - From: Scott Stewart [EMAIL PROTECTED] To: CF-Talk cf-talk@houseoffusion.com Sent: Tuesday, August 26, 2008 12:45 PM Subject: cfscript question Is it possible to do a query output loop in cfscript using something other than WriteOutput? ~| 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:311613 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: cfscript question
Is it possible to do a query output loop in cfscript using something other than WriteOutput? The only way to write any output directly from CFSCRIPT is to use WriteOutput. You can, of course, invoke functions written in CFML from CFSCRIPT. 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:311617 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: cfscript question
lemme rephrase... I'm trying to populate a function call, by looping over the record count of a query to end up with something like this: function(sunday_0, mon_0, tues_0) function(sunday_1, monday_1, tues_1) etc. the number is dynamic based on the record count of a query.. code: if(IsDefined(url.edit)){ For (i=1;i LTE get_category.Recordcount; i=i+1) category_id = get_category.id[i]; sunday = session.tmp_sunday_get_category.id[i]; monday = session.tmp_monday_get_category.id[i]; tuesday = session.tmp_tuesday_get_category.id[i]; wednesday= session.tmp_wednesday_get_category.id[i]; thursday = session.tmp_thursday_get_category.id[i]; friday = session.tmp_friday_get_category.id[i]; saturday = session.tmp_saturday_get_category.id[i]; update_time = application.studySYS.timetrex_updateStudyTime(study_id,category_id,sunday,,monday,tuesday,wednesday,thursday,friday,saturday); }else{ For (i=1;i LTE get_category.Recordcount; i=i+1) category_id = get_category.id[i]; sunday = session.tmp_sunday_get_category.id[i]; monday = session.tmp_monday_get_category.id[i]; tuesday = session.tmp_tuesday_get_category.id[i]; wednesday= session.tmp_wednesday_get_category.id[i]; thursday = session.tmp_thursday_get_category.id[i]; friday = session.tmp_friday_get_category.id[i]; saturday = session.tmp_saturday_get_category.id[i]; insert_time = application.studySYS.timetrex_insertStudyTime(study_id,category_id,sunday,,monday,tuesday,wednesday,thursday,friday,saturday); } Dave Watts wrote: Is it possible to do a query output loop in cfscript using something other than WriteOutput? The only way to write any output directly from CFSCRIPT is to use WriteOutput. You can, of course, invoke functions written in CFML from CFSCRIPT. 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:311619 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cfscript question
yea but...function calls shouldn't have dynamic number of arguments. perhaps u mean to create a list of arguments and pass it in as 1 argument? ~| 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:311622 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: cfscript question
yea but...function calls shouldn't have dynamic number of arguments. Why not? 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:311623 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: cfscript question
I'm trying to populate a function call, by looping over the record count of a query What you have looks fine to me. What's the problem, exactly? 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:311624 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: CFSCRIPT Question
Thanks all for your feedback, this has definitely made me think again about the use of cfscript. I just suppose it is a comfort thing so while it is not detrimental I shall still use it. Thanks again. -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: 02 January 2006 19:51 To: CF-Talk Subject: RE: CFSCRIPT Question I was under the impression that there was a performance gain with cfscript, is that not the case? Is there no benefit to using cfscript? I haven't been able to determine any significant performance change one way or the other with CFMX. There may have been performance differences in prior versions of CF, and UDFs in CF 5 were generally much faster than similar CFML custom tags, but none of that applies to CFMX. 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! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228173 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFSCRIPT Question
I was under the impression that there was a performance gain with cfscript, is that not the case? Is there no benefit to using cfscript? -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: 30 December 2005 19:03 To: CF-Talk Subject: Re: CFSCRIPT Question Probably not, could be debated that it was on older versions of CF. I personally am a cfscript nazi, use it a lot more than I really should. On 12/30/05, Ben Doom [EMAIL PROTECTED] wrote: Is it ever actually necessary? :-) --Ben ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228124 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFSCRIPT Question
pre-MX6.1 there was a performance gain. Now, if I understand correctly, it all compiles down to the same java bytecode, so there's no performance gain to speak of. As far as there still being a 'benefit' to using it...I guess that's subjective. Some people like the script syntax better than tags. Some find it easier to read. I think, at the very least, if you're setting a ton of variables, cfscript is a bit quicker to type out. cfset varA = foo1 / cfset varB = foo2 / cfset varC = foo3 / varA = foo1; varB = foo2; varC = foo3; without having to type out the 'cfset' explicitly for each line (not to mention the brackets), it's simply fewer keystrokes per line. Whether or not you find that to be a benefit (or at least, benefit enough to use cfscript if you're more comfortable with tags) is entirely your call. On 1/2/06, Andy McShane [EMAIL PROTECTED] wrote: I was under the impression that there was a performance gain with cfscript, is that not the case? Is there no benefit to using cfscript? -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: 30 December 2005 19:03 To: CF-Talk Subject: Re: CFSCRIPT Question Probably not, could be debated that it was on older versions of CF. I personally am a cfscript nazi, use it a lot more than I really should. On 12/30/05, Ben Doom [EMAIL PROTECTED] wrote: Is it ever actually necessary? :-) --Ben ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228126 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFSCRIPT Question
I am not aware of any benefit other than personal preference... Eric On Mon, 2 Jan 2006 11:38:27 - Andy McShane [EMAIL PROTECTED] wrote: I was under the impression that there was a performance gain with cfscript, is that not the case? Is there no benefit to using cfscript? -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: 30 December 2005 19:03 To: CF-Talk Subject: Re: CFSCRIPT Question Probably not, could be debated that it was on older versions of CF. I personally am a cfscript nazi, use it a lot more than I really should. On 12/30/05, Ben Doom [EMAIL PROTECTED] wrote: Is it ever actually necessary? :-) --Ben ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228140 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFSCRIPT Question
I think the benefit was always a SLIGHT performance increase. I don't know that it was ever actually processed faster than a normal tag based method but 99.9% of the time, it takes less code in cfscript to get the job done which makes for a smaller file size in the end which WOULD be processed faster. I guess whether or not you would see or even notice an increase depends on how big your file is and how much you could reduce its overall size using cfscript. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -Original Message- From: Owner, Three Ravens Consulting [mailto:[EMAIL PROTECTED] Sent: Monday, January 02, 2006 1:07 PM To: CF-Talk Subject: Re: CFSCRIPT Question I am not aware of any benefit other than personal preference... Eric On Mon, 2 Jan 2006 11:38:27 - Andy McShane [EMAIL PROTECTED] wrote: I was under the impression that there was a performance gain with cfscript, is that not the case? Is there no benefit to using cfscript? -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: 30 December 2005 19:03 To: CF-Talk Subject: Re: CFSCRIPT Question Probably not, could be debated that it was on older versions of CF. I personally am a cfscript nazi, use it a lot more than I really should. On 12/30/05, Ben Doom [EMAIL PROTECTED] wrote: Is it ever actually necessary? :-) --Ben ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228143 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFSCRIPT Question
I was under the impression that there was a performance gain with cfscript, is that not the case? Is there no benefit to using cfscript? I haven't been able to determine any significant performance change one way or the other with CFMX. There may have been performance differences in prior versions of CF, and UDFs in CF 5 were generally much faster than similar CFML custom tags, but none of that applies to CFMX. 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! ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228153 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFSCRIPT Question
how do I call a stored procedure from within cfscript? Wrap it in a cffunction tag and call it as a function. Paul ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227976 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFSCRIPT Question
I was sure I read that tags were allowed inside cfscript blocks somewhere, but it doesn't appear to work. -Original Message- From: Andy Mcshane [mailto:[EMAIL PROTECTED] Sent: 30 December 2005 10:46 To: CF-Talk Subject: CFSCRIPT Question I have a large block of cfscript that I now have to add a stored procedure call into the middle of. I normally use cfstoredproc elsewhere but how do I call a stored procedure from within cfscript? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227977 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFSCRIPT Question
how do I call a stored procedure from within cfscript? Wrap it in a cffunction tag and call it as a function. Paul Now I feel stupid, knew it would be something simple! Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227978 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFSCRIPT Question
Sounds like you are using cfscript unnecessarily. -Adam On 12/30/05, Andy Mcshane [EMAIL PROTECTED] wrote: how do I call a stored procedure from within cfscript? Wrap it in a cffunction tag and call it as a function. Paul Now I feel stupid, knew it would be something simple! Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227982 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFSCRIPT Question
Is it ever actually necessary? :-) --Ben Adrocknaphobia wrote: Sounds like you are using cfscript unnecessarily. -Adam On 12/30/05, Andy Mcshane [EMAIL PROTECTED] wrote: how do I call a stored procedure from within cfscript? Wrap it in a cffunction tag and call it as a function. Paul Now I feel stupid, knew it would be something simple! Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227986 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFSCRIPT Question
Probably not, could be debated that it was on older versions of CF. I personally am a cfscript nazi, use it a lot more than I really should. On 12/30/05, Ben Doom [EMAIL PROTECTED] wrote: Is it ever actually necessary? :-) --Ben ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228013 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFScript question - Queries
I think you need to escape (i.e. double up) the single quotes in any CF vars you're using in the query, then use preservesinglequotes() inside cfquery tag. cfscript mySQLstring = SELECT orders_id FROM Orders WHERE label = '#Replace(This_Label, ', '', all)#'; /cfscript cfquery name=qwe datasource=myDsn #PreserveSingleQuotes(mySQLstring)# /cfquery Cheers Bert On Wed, 8 Dec 2004 18:08:02 -0500, C. Hatton Humphrey [EMAIL PROTECTED] wrote: Why not just double up the single quotes? Tried that - may be a NDA thing or just a MySQL thing - I got the same error when sending the query. To answer Barney's question - I'm using a MySQL database. That's what the clent has and I haven't been able to dissuade him from using it. When I sent the query select orders_id from orders where label = '#This_Label#' ... I get a SQL error showing the doubled-up quotes. Hatton ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186764 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFScript question - Queries
I use preserveSingleQuotes with MySQL without any issue. You shouldn't need to do anything special: cfset sql = select * from mytable where name = 'barneyb' / cfquery ... #preserveSingleQuotes(sql)# /cfquery On Wed, 8 Dec 2004 18:08:02 -0500, C. Hatton Humphrey [EMAIL PROTECTED] wrote: Why not just double up the single quotes? Tried that - may be a NDA thing or just a MySQL thing - I got the same error when sending the query. To answer Barney's question - I'm using a MySQL database. That's what the clent has and I haven't been able to dissuade him from using it. When I sent the query select orders_id from orders where label = '#This_Label#' ... I get a SQL error showing the doubled-up quotes. Hatton -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/blog/ ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186836 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFScript question - Queries
If you're using CF variables in your SQL you may* need to escape any single quotes when you're creating your SQL statement in the first place: cfset user = Barney O'Boivert cfset sql = select * from mytable where name = '#Replace(user, ', '', all))#' / cfquery ... #preserveSingleQuotes(sql)# /cfquery Bert * if there's any chance they will contain single quotes then you'll need to escape them On Thu, 9 Dec 2004 08:23:07 -0800, Barney Boisvert [EMAIL PROTECTED] wrote: I use preserveSingleQuotes with MySQL without any issue. You shouldn't need to do anything special: cfset sql = select * from mytable where name = 'barneyb' / cfquery ... #preserveSingleQuotes(sql)# /cfquery On Wed, 8 Dec 2004 18:08:02 -0500, C. Hatton Humphrey [EMAIL PROTECTED] wrote: Why not just double up the single quotes? Tried that - may be a NDA thing or just a MySQL thing - I got the same error when sending the query. To answer Barney's question - I'm using a MySQL database. That's what the clent has and I haven't been able to dissuade him from using it. When I sent the query select orders_id from orders where label = '#This_Label#' ... I get a SQL error showing the doubled-up quotes. Hatton -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/blog/ ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186926 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFScript question - Queries
What database are you using? preserveSingleQuotes() has always worked for me, exactly as intended. However, before you go too far down this road, I'd recommend not using CFSCRIPT for this code, because there is a query inside. Sure, you can make a wrapper, as you tried, but doing that will prevent you from using CFQUERYPARAM, will force you to put your SQL in a string (rather than inlined, where it's both easier to read, and available for tools to operate on), and will generally make for code that's less readable, because it's dramatically different than 99.9% of CF code (which uses CFQUERY directly). Of course, you're the one with the knowledge of your particular situation, not I, so you're the only one who can make an informed decision. So don't just assume I know what I'm talking about, and that it applies to your specific case. cheers, barneyb On Wed, 8 Dec 2004 15:20:54 -0500, C. Hatton Humphrey [EMAIL PROTECTED] wrote: Okay, to try and make my life easier I decided to try changing a block of code from CFSet to CFScript. However, part of what I need to do in this code is run a query based on a variable value... I'm pulling a label out of a record body and need to get the id of a record where a certian field matches that value. I'm reading an email that contains fixed width tables that hold some data I need to import. Anyway, I made all the CFScript changes and created a query called RunQuery that takes one parameter - SQL Statement. If I had SQL Server I know how I would do this, using a stored procedure. but I don't. When I try to pass the generated SQL Statement (select from where label = '#This_Label#') CF is barfing on me because it instantly escapes the single quotes. When I tried adding preserve singlequotes the error comes up looking at the sinqlequoetes with a \ in front... nice way of preserving those quotes. Any suggestions? I've had to revert the code back to a ton of CFSets until I can get the queries working. Thanks! Hatton -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/blog/ ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186682 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFScript question - Queries
Why not just double up the single quotes? Okay, to try and make my life easier I decided to try changing a block of code from CFSet to CFScript. However, part of what I need to do in this code is run a query based on a variable value... I'm pulling a label out of a record body and need to get the id of a record where a certian field matches that value. I'm reading an email that contains fixed width tables that hold some data I need to import. Anyway, I made all the CFScript changes and created a query called RunQuery that takes one parameter - SQL Statement. If I had SQL Server I know how I would do this, using a stored procedure. but I don't. When I try to pass the generated SQL Statement (select from where label = '#This_Label#') CF is barfing on me because it instantly escapes the single quotes. When I tried adding preserve singlequotes the error comes up looking at the sinqlequoetes with a in front... nice way of preserving those quotes. Any suggestions? I've had to revert the code back to a ton of CFSets until I can get the queries working. Thanks! Hatton ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186685 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFScript question - Queries
Why not just double up the single quotes? Tried that - may be a NDA thing or just a MySQL thing - I got the same error when sending the query. To answer Barney's question - I'm using a MySQL database. That's what the clent has and I haven't been able to dissuade him from using it. When I sent the query select orders_id from orders where label = '#This_Label#' ... I get a SQL error showing the doubled-up quotes. Hatton ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186699 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: cfscript question
Yeah, they're in the VARIABLES scope.There's really no difference between a CFSCRIPT function and a CFFUNCTION one, except that you can use tags, declare named optional arguments and do typechecking with CFFUNCTION.Other than that, I believe the two are 100% equivalent. Cheers, barneyb -Original Message- From: Jim McAtee [mailto:[EMAIL PROTECTED] Sent: Friday, May 07, 2004 10:33 AM To: CF-Talk Subject: cfscript question If the declaration of variables using var within cfscript isn't necessary, what kind of variables are being created?Are they in the variables scope? For example, the variables 'sdatefmt' and 'edatefmt' in the cf function shown below: function DateRangeFormat(sdate, edate, mask, divider) { if (IsDate(sdate)) sdatefmt = DateFormat(sdate, mask); else sdate = ; if (IsDate(edate)) edatefmt = DateFormat(edate, mask); else edate = ; if (Len(sdatefmt) and Len(edatefmt) and (sdatefmt is not edatefmt)) return sdatefmt divider edatefmt; else if (Len(sdatefmt)) return sdatefmt; else if (Len(edatefmt)) return edatefmt; else return ; } [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question
Yes, the variables are in the variables scope. While it is not necessary to use the var statement, you probably want to for such things as loop counters and other local variables. http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/udfs12.htm http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/udfs12.htm HTH --Nathan From: Jim McAtee [mailto:[EMAIL PROTECTED] Sent: Friday, May 07, 2004 1:33 PM To: CF-Talk Subject: cfscript question If the declaration of variables using var within cfscript isn't necessary, what kind of variables are being created?Are they in the variables scope? For example, the variables 'sdatefmt' and 'edatefmt' in the cf function shown below: function DateRangeFormat(sdate, edate, mask, divider) { if (IsDate(sdate)) sdatefmt = DateFormat(sdate, mask); else sdate = ; if (IsDate(edate)) edatefmt = DateFormat(edate, mask); else edate = ; if (Len(sdatefmt) and Len(edatefmt) and (sdatefmt is not edatefmt)) return sdatefmt divider edatefmt; else if (Len(sdatefmt)) return sdatefmt; else if (Len(edatefmt)) return edatefmt; else return ; } [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question
What makes you think it is isn't necessary? Any variable created inside a cfscript based function, or a cffunction based function, must be var scoped. Period. (Well, ok, yea, it works w/o the var scope, but leaving them off is very risky.) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: cfscript question
- Original Message - From: Raymond Camden [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, May 07, 2004 11:49 AM Subject: RE: cfscript question What makes you think it is isn't necessary? Because it isn't.Period. Any variable created inside a cfscript based function, or a cffunction based function, must be var scoped. Period. (Well, ok, yea, it works w/o the var scope, but leaving them off is very risky.) You have to understand _why_ it's risky.Not just it's risky and leave it at that. But it was a simple question.If not declared, in which scope are the variables created? [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question
What makes you think it is isn't necessary? Because it isn't.Period. I think I was very clear just a few words later that this was just my opinion. Any variable created inside a cfscript based function, or a cffunction based function, must be var scoped. Period. (Well, ok, yea, it works w/o the var scope, but leaving them off is very risky.) You have to understand _why_ it's risky.Not just it's risky and leave it at that. Others had already answered where the variables get declared. I didn't think I had to speak down to him. ;) Point is - as the admin at cflib - I still see many submissions from folks who do not properly scope variables. I have no issue telling people they MUST var scope. Some things are worth being anal/overly strict/etc about. :) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question
What makes you think it is isn't necessary? Because it isn't.Period. Required and necessary are two different things.Using 'var' isn't required, but it is definitely necessary, at least in anything approaching normal circumstances. Cheers, barneyb [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: cfscript question
Required and necessary are two different things. In logic terms, they are not. Using 'var' isn't required, but it is definitely necessary, Let's say it's recommended, not required nor necessary, but highly recommended. -- ___ See some cool custom tags here: http://www.contentbox.com/claude/customtags/tagstore.cfm Please send any spam to this address: [EMAIL PROTECTED] Thanks. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
I like this better: IF(StructKeyExists(form,Listgeat(fieldlist,i)) { } One of the reasons I like using Cfscript is to get rid of pound signs and quotes- seems more readable. Just my 02. -mark -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 3:46 PM To: CF-Talk Subject: RE: cfscript question... Using CF5. The error is... Parameter 1 of function IsDefined which is now FORM[listgetat(FieldList,i)] must be a syntactically valid variable name. -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:31 PM To: CF-Talk Subject: RE: cfscript question... don't you need {}'s around theFORM[listgetat(FieldList,i)] = ; or if not, what error are you getting? ...tony tony weeg senior web applications architect navtrak, inc. www.navtrak.net [EMAIL PROTECTED] 410.548.2337 -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: cfscript question...
My .02 agrees with your .02 - Calvin - Original Message - From: Mark A. Kruger - CFG To: CF-Talk Sent: Friday, November 07, 2003 9:43 AM Subject: RE: cfscript question... I like this better: IF(StructKeyExists(form,Listgeat(fieldlist,i)) { } One of the reasons I like using Cfscript is to get rid of pound signs and quotes- seems more readable. Just my 02. -mark -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 3:46 PM To: CF-Talk Subject: RE: cfscript question... Using CF5. The error is... Parameter 1 of function IsDefined which is now FORM[listgetat(FieldList,i)] must be a syntactically valid variable name. -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:31 PM To: CF-Talk Subject: RE: cfscript question... don't you need {}'s around theFORM[listgetat(FieldList,i)] = ; or if not, what error are you getting? ...tony tony weeg senior web applications architect navtrak, inc. www.navtrak.net [EMAIL PROTECTED] 410.548.2337 -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
Does that make it .0004 cents? -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2003 10:36 AM To: CF-Talk Subject: Re: cfscript question... My .02 agrees with your .02 - Calvin - Original Message - From: Mark A. Kruger - CFG To: CF-Talk Sent: Friday, November 07, 2003 9:43 AM Subject: RE: cfscript question... I like this better: IF(StructKeyExists(form,Listgeat(fieldlist,i)) { } One of the reasons I like using Cfscript is to get rid of pound signs and quotes- seems more readable. Just my 02. -mark -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 3:46 PM To: CF-Talk Subject: RE: cfscript question... Using CF5. The error is... Parameter 1 of function IsDefined which is now FORM[listgetat(FieldList,i)] must be a syntactically valid variable name. -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:31 PM To: CF-Talk Subject: RE: cfscript question... don't you need {}'s around theFORM[listgetat(FieldList,i)] = ; or if not, what error are you getting? ...tony tony weeg senior web applications architect navtrak, inc. www.navtrak.net [EMAIL PROTECTED] 410.548.2337 -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
don't you need {}'s around theFORM[listgetat(FieldList,i)] = ; or if not, what error are you getting? ...tony tony weeg senior web applications architect navtrak, inc. www.navtrak.net [EMAIL PROTECTED] 410.548.2337 -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
I assume you want to see if form[X] is defined, were X is from fieldList. You are missing a # sign: if(not isDefined(form.#listGetAt(fieldlist,i)#)) form[listGetAt(fieldList,i)] = ; Also note I switched to dot notation for the isDefined check. If you want to use brackets, switch to structKeyExists if(not structKeyExists(form, listGetAt(fieldlist,i)) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
What is it not doing right? One thing, isDefined wants a simple string.Try: if (NOT isDefined(FORM[#listgetat(FieldList,i)#])) Jann -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 1:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
Using CF5. The error is... Parameter 1 of function IsDefined which is now FORM[listgetat(FieldList,i)] must be a syntactically valid variable name. -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:31 PM To: CF-Talk Subject: RE: cfscript question... don't you need {}'s around theFORM[listgetat(FieldList,i)] = ; or if not, what error are you getting? ...tony tony weeg senior web applications architect navtrak, inc. www.navtrak.net [EMAIL PROTECTED] 410.548.2337 -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
your isDefined() call must be passed a string containing a valid variable name.So you probably want that line to say this: if (NOT isDefined(form.#listGetAt(fieldlist, i)#)) barneyb -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 1:26 PM To: CF-Talk Subject: cfscript question... What am I doing wrong here? cfscript // Intialize List FieldList = CustEmail,CustPassword,CustPassword2,BillFirstName,BillLastName,BillAddress ,BillAddress2,BillCity,BillState,BillZip,BillPhone; // Loop thru list and define all FORM variables for(i=1; i LTE listlen(FieldList); i = i + 1) if (NOT isDefined(FORM[listgetat(FieldList,i)])) FORM[listgetat(FieldList,i)] = ; /cfscript Che Vilnonis Application Developer Advertising Systems Incorporated 8470C Remington Avenue Pennsauken, NJ 08110 p: 856.488.2211 f: 856.488.1990 www.asitv.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: cfscript question...
that was it Ray... btw, how do you know all of this stuff? you must use more than 10% of your brain :) -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 4:33 PM To: CF-Talk Subject: RE: cfscript question... I assume you want to see if form[X] is defined, were X is from fieldList. You are missing a # sign: if(not isDefined(form.#listGetAt(fieldlist,i)#)) form[listGetAt(fieldList,i)] = ; Also note I switched to dot notation for the isDefined check. If you want to use brackets, switch to structKeyExists if(not structKeyExists(form, listGetAt(fieldlist,i)) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: CFSCRIPT question
cfif not structKeyExists(session.cart, attributes.name blah /cfif - Original Message - From: "Jon Tillman" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 07:27 Subject: CFSCRIPT question I have the following as cfscript: if (not(structKeyExists(session.cart, attributes.name))) I would like to use it as a CFIF statement. Any ideas how to go about constructing said cfif? -- *** Jon Tillman LINUX USER: #141163 ICQ: 4015362 http://www.eruditum.org [EMAIL PROTECTED] *** Help Jon build a network! Looking for giveaway computers parts Current Need: Tape Drive PI/PII processors Email me to find out how you can help *** -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: CFSCRIPT question
Oops. Left off a ) Should be cfif not structKeyExists(session.cart, attributes.name) blah /cfif - Original Message - From: "David E. Crawford" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 12:56 Subject: Re: CFSCRIPT question cfif not structKeyExists(session.cart, attributes.name blah /cfif - Original Message - From: "Jon Tillman" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 07:27 Subject: CFSCRIPT question I have the following as cfscript: if (not(structKeyExists(session.cart, attributes.name))) I would like to use it as a CFIF statement. Any ideas how to go about constructing said cfif? -- *** Jon Tillman LINUX USER: #141163 ICQ: 4015362 http://www.eruditum.org [EMAIL PROTECTED] *** Help Jon build a network! Looking for giveaway computers parts Current Need: Tape Drive PI/PII processors Email me to find out how you can help *** -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: CFSCRIPT question
How would you then check for a particular value of a key within the same cfif? In other words I am doing something similar where I am checking for the existence of a key but then how do I filter so I get only those whose value is, say, a specific date? Thanks -Original Message- From: David E. Crawford [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 24, 2000 9:00 AM To: [EMAIL PROTECTED] Subject: Re: CFSCRIPT question Oops. Left off a ) Should be cfif not structKeyExists(session.cart, attributes.name) blah /cfif - Original Message - From: "David E. Crawford" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 12:56 Subject: Re: CFSCRIPT question cfif not structKeyExists(session.cart, attributes.name blah /cfif - Original Message - From: "Jon Tillman" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 07:27 Subject: CFSCRIPT question I have the following as cfscript: if (not(structKeyExists(session.cart, attributes.name))) I would like to use it as a CFIF statement. Any ideas how to go about constructing said cfif? -- *** Jon Tillman LINUX USER: #141163 ICQ: 4015362 http://www.eruditum.org [EMAIL PROTECTED] *** Help Jon build a network! Looking for giveaway computers parts Current Need: Tape Drive PI/PII processors Email me to find out how you can help *** -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: CFSCRIPT question
cfscript if (NOT StructKeyExists(SESSION.car, ATTRIBUTES.name)) { do stuff here } else { do other stuff here } /cfscript The "else" is actually optional. But I figured I'd throw it in as an example. Sharon -Original Message- From: Jon Tillman [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Friday, August 25, 2000 3:28 AM Subject: CFSCRIPT question I have the following as cfscript: if (not(structKeyExists(session.cart, attributes.name))) I would like to use it as a CFIF statement. Any ideas how to go about constructing said cfif? -- *** Jon Tillman LINUX USER: #141163 ICQ: 4015362 http://www.eruditum.org [EMAIL PROTECTED] *** Help Jon build a network! Looking for giveaway computers parts Current Need: Tape Drive PI/PII processors Email me to find out how you can help *** --- --- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: CFSCRIPT question
If we're still talking cfscript: cfscript if (StructKeyExists(SESSION.cart, ATTRIBUTES.name)) { myValue = SESSION.cart[ATTRIBUTES.name]; } else { myValue = "not Defined"; } /cfscript You can refer to structures either throught dot notation: SESSION.cart.item Or with array notation: SESSION.cart[item] (if item is a variable containing the name OR SESSION.cart["item"] (if item is a literal value. Sharon -Original Message- From: Andrea Wasik(CancerSource) [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Friday, August 25, 2000 10:05 AM Subject: RE: CFSCRIPT question How would you then check for a particular value of a key within the same cfif? In other words I am doing something similar where I am checking for the existence of a key but then how do I filter so I get only those whose value is, say, a specific date? Thanks -Original Message- From: David E. Crawford [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 24, 2000 9:00 AM To: [EMAIL PROTECTED] Subject: Re: CFSCRIPT question Oops. Left off a ) Should be cfif not structKeyExists(session.cart, attributes.name) blah /cfif - Original Message - From: "David E. Crawford" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 12:56 Subject: Re: CFSCRIPT question cfif not structKeyExists(session.cart, attributes.name blah /cfif - Original Message - From: "Jon Tillman" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 07:27 Subject: CFSCRIPT question I have the following as cfscript: if (not(structKeyExists(session.cart, attributes.name))) I would like to use it as a CFIF statement. Any ideas how to go about constructing said cfif? -- *** Jon Tillman LINUX USER: #141163 ICQ: 4015362 http://www.eruditum.org [EMAIL PROTECTED] *** Help Jon build a network! Looking for giveaway computers parts Current Need: Tape Drive PI/PII processors Email me to find out how you can help *** -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. --- - -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. --- --- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: CFSCRIPT Question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You can't use any kind of tag in cfscript. 4.5 finally has support for creating objects in script instead of with CFObject, but that's about the best you can do so far. I do hope Allaire makes the rest of CF's functionality accessible from script soon! (I know Dixon isn't actually in Ticonderoga any more, but I grew up there. It's neat to see the name again...) Best regards, Zac Bedell -Original Message- From: Robert Everland [mailto:[EMAIL PROTECTED]] Sent: Monday, July 10, 2000 3:37 PM To: '[EMAIL PROTECTED]' Subject: CFSCRIPT Question Can I use cflocation in a cfscript or it only does if then else and loops. Robert Everland III Web Developer Dixon Ticonderoga -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.3 for non-commercial use http://www.pgp.com Comment: Please use PGP!!! iQA/AwUBOWooPwraVoMWBwRBEQJjZQCfTgVngfemtyF+htO1L08b+seBu9YAoL7K qpQjPmGtbZDvdW5dwVqhnlii =NbeT -END PGP SIGNATURE- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: CFSCRIPT Question??
Remove the quotes around URL.PAGE. Right now you're setting PAGE to the value "url.page" (which I assume you don't want to do) instead of the value contained in url.page. Also add a break; as the last statement in each of the cases. Without the breaks, the statement will continue processing the statements in the other cases, until it reaches the end of the switch statement or a break. switch(page) { page = url.page; switch(page) { case 1: { // some stuff break; } case 2: { // some other stuff break; } default: { // default stuff break; } } } Hope that helps! ~ Rob Mulcahey Programmer James Tower 507-386-9380 [EMAIL PROTECTED] ~ -Original Message- From: Bill Killillay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 09, 2000 6:20 PM To: Cf-Talk Subject: CFSCRIPT Question?? When I pass this page the URL variable of 1 through what ever or nothing they all return the default value. Why is that? There is nothing to this page, but for some reason every time it will either give me the default case value, or if I take the default out it gives me number 8. Every time! CFSCRIPT PAGE = "URL.PAGE"; SWITCH (PAGE){ /* Home page for resilient */ CASE 1 : COPY_BLOCK = 'resilient_home.cfm'; FOOTER = 'resilient_footer.cfm'; BACKGROUND = 'background_resilient_home.gif'; TITLE = 'Resilient Home'; // Resilient search page CASE 2 : COPY_BLOCK = 'resilient_search.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient Product Search'; // Pages 3 through 6 are Resilient Technical pages CASE 3 : COPY_BLOCK = 'resilient_technical.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background_resilient_technical.gif'; TITLE = 'Resilient - Technical'; CASE 4 : COPY_BLOCK = 'resilient_professional_installation_guide.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Professional Installation Guide'; CASE 5 : COPY_BLOCK = 'resilient_installations.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Installation'; CASE 6 : COPY_BLOCK = 'resilient_matting_systems.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Matting Systems'; // Pages 7 through 8 is Resilient Installation Profiles CASE 7 : COPY_BLOCK = 'resilient_installation_profiles.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background_resilient_home.gif'; TITLE = 'Resilient - Installation Profiles'; CASE 8 : COPY_BLOCK = 'resilient_installation_profiles_drill_down.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Installation Profiles'; DEFAULT : TITLE = ''; } /CFSCRIPT html head titleCFOUTPUT#TITLE#/CFOUTPUT/title /head body CFOUTPUT#TITLE#/CFOUTPUT /body /html Bill Killillay ICQ @ 8425781 *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* "An investment in Knowledge always pays the best interest." -Benjamin Franklin- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* Get Paid to Surf the Web. It's free, easy and fun. Sign up for AllAdvantage.com at http://alladvantage.com/go.asp?refid=FIB-034 Most of us are on it every day all day anyway, why not give yourself a pay raise for 25
RE: CFSCRIPT Question??
Bill, Here are two suggestions. I know CF variables are typeless butit might help. Try putting quotes around each case. Eg. CASE "1":... CASE "2":.. and so on. Also you might want to place each case within {}s. Eg. CASE 1":{ COPY_BLOCK...; ...TITLE="whatever"; } Hope this helps. Leong PS: I've just noticed... Logical error. You've just assigned the variable, page, with the literal VALUE of URL.PAGE. As a result no matter what value you assign URL.PAGE, the variable PAGE will always be the same. You should use this: PAGE = "#URL.PAGE#" or PAGE = URL.PAGE -Original Message- From: Bill Killillay [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 10, 2000 8:50 AM To: Cf-Talk Subject: CFSCRIPT Question?? When I pass this page the URL variable of 1 through what ever or nothing they all return the default value. Why is that? There is nothing to this page, but for some reason every time it will either give me the default case value, or if I take the default out it gives me number 8. Every time! CFSCRIPT PAGE = "URL.PAGE"; SWITCH (PAGE){ /* Home page for resilient */ CASE 1 : COPY_BLOCK = 'resilient_home.cfm'; FOOTER = 'resilient_footer.cfm'; BACKGROUND = 'background_resilient_home.gif'; TITLE = 'Resilient Home'; // Resilient search page CASE 2 : COPY_BLOCK = 'resilient_search.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient Product Search'; // Pages 3 through 6 are Resilient Technical pages CASE 3 : COPY_BLOCK = 'resilient_technical.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background_resilient_technical.gif'; TITLE = 'Resilient - Technical'; CASE 4 : COPY_BLOCK = 'resilient_professional_installation_guide.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Professional Installation Guide'; CASE 5 : COPY_BLOCK = 'resilient_installations.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Installation'; CASE 6 : COPY_BLOCK = 'resilient_matting_systems.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Matting Systems'; // Pages 7 through 8 is Resilient Installation Profiles CASE 7 : COPY_BLOCK = 'resilient_installation_profiles.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background_resilient_home.gif'; TITLE = 'Resilient - Installation Profiles'; CASE 8 : COPY_BLOCK = 'resilient_installation_profiles_drill_down.cfm'; FOOTER = 'main_footer.cfm'; BACKGROUND = 'background.gif'; TITLE = 'Resilient - Installation Profiles'; DEFAULT : TITLE = ''; } /CFSCRIPT html head titleCFOUTPUT#TITLE#/CFOUTPUT/title /head body CFOUTPUT#TITLE#/CFOUTPUT /body /html Bill Killillay ICQ @ 8425781 *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* "An investment in Knowledge always pays the best interest." -Benjamin Franklin- *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* Get Paid to Surf the Web. It's free, easy and fun. Sign up for AllAdvantage.com at http://alladvantage.com/go.asp?refid=FIB-034 Most of us are on it every day all day anyway, why not give yourself a pay raise for 25 hours a month. -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.eGroups.com/list/cf-talk To