Well, I don't think it is quite like leaving out a period.  A period is a
required function to denote the closing of a sentence.

Pound signs are only required when a variable explicitly needs to be
evaluated.  The rest of the time they are optional.

And your example:

<cfset variables.my_var = "#query.column#">

is flawed because if the value of query.column holds a numeric value, it
will be converted to a string.  The way the statement is structured, someone
reading that line would read that the intention of the statement is to
assign a STRING to the variable my_var.  If the variable query.column holds
a numeric value then this statement is misleading and incorrect.  Because
Cold Fusion is untyped, this USUALLY does not pose problems but it could
potentially cause problems.

And as for your other example:

<cfset variables.my_var = "query.column">

This statement puts the STRING "query.column" into the variable my_var.  You
are not getting the value of the query.column variable.


Reuben Poon



-----Original Message-----
From: Paul Giesenhagen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 09, 2002 1:54 PM
To: CF-Talk
Subject: Re: Form.FIELDNAME - error!!!!
Importance: Low


I understand your point, but it is like saying periods clutter up pages in a
book.

If you have:

<cfset variables.my_var = "#query.column#">
That tells me that there is a variable being set and it is a string

<cfset variables.my_var = "query.column">

Am I setting my variable to the two words seperated by a period,
query.column? or to a variable query.column?

To each his own, but it makes more sense to me to see those pounds on the
right hand side ..  Plus reading a book with periods is easier too :)

Paul Giesenhagen
QuillDesign
http://www.quilldesign.com
SiteDirector Commerce Builder




> I think that the # on the right side of the set operand is redundant.
>
> <CFSET my_var = #another_var#>
>
> or
>
> <CFSET my_var = another_var>
>
> There is only one thing for *another_var* to be: a variable.  If you
wanted
> my_var to hold the string "another_var" you should quote the right hand
> side:
>
> <CFSET my_var = "another_var">
>
> So my .02 is that pounds just clutter up your statement.
>
> Reuben Poon
>
>
> -----Original Message-----
> From: Paul Giesenhagen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 09, 2002 1:35 PM
> To: CF-Talk
> Subject: Re: Form.FIELDNAME - error!!!!
> Importance: Low
>
>
> Tim,
>
> I wouldn't call that bad practice, It should actually be called good
> practice (at least in my book).  You are setting a variable and the ##
> around the variable show that it is a variable, makes for easier reading.
> Now, ## on the set side would be considered bad practice.
>
> my .02
>
> Paul Giesenhagen
> QuillDesign
> http://www.quilldesign.com
> SiteDirector Commerce Builder
>
>
> > Not sure if this is an error or just a bad practice, but you don't need
> the
> > # signs in your variable declaration (cfset)
> >
> > <CFSET var = ListGetAt(Form.FIELDNAMES, i)>
> >
> > works just fine.  Also you don't need to generate that var at all you
can
> > just do a list loop like this:
> >
> > <CFLOOP list="#form.fieldnames#" index="formField">
> > #formField# = #evaluate(formField)#
> > <CFLOOP>
> >
> > Tim Heald
> > ACP/CCFD :)
> > Application Development
> > www.schoollink.net
> >
> > > -----Original Message-----
> > > From: Chakka, Sudheer [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, May 09, 2002 4:16 PM
> > > To: CF-Talk
> > > Subject: Form.FIELDNAME - error!!!!
> > >
> > >
> > > Hi,
> > >
> > >  Can any one tell me what is the mistake in
> > >
> > > <CFLOOP FROM="1" TO="#ListLen(FORM.FIELDNAMES)#" STEP="1" INDEX="i">
> > > <CFSET var = #ListGetAt(Form.FIELDNAMES, i)#>
> > > #ListGetAt(Form.FIELDNAMES, i)# = #Evaluate(var)#
> > > <BR>
> > > </CFLOOP>
> > >
> > >
> > > I am getting the following error:
> > >
> > > An error occurred while evaluating the expression:
> > > "#ListLen(FORM.FIELDNAMES)#"
> > >
> > >
> > >  Any help on this is appreciated.
> > >
> > > thanks,
> > > Sudheer Chakka.
> > >
> > >
> >
>
>

______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to