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
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
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
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
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
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:
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
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
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
: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
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
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
?
-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
, 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
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
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%
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
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
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.
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
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
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
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:
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)#
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
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
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
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
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
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]
- 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
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
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]
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:
, 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
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
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
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:
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
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
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
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
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
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
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 struc
: 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. Cra
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
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
-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
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
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:
51 matches
Mail list logo