Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / June 2005



Tip: Looking for answers? Try searching our database.

Cfloop..

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Seth Buntin - 28 Jun 2005 17:06 GMT
I am trying to loop over a list:

<cfquery name="updsyllabus" datasource="#arguments.syl.dsn#">
                UPDATE #arguments.syl.tname# SET
                    <cfloop list="#arguments.syl.cols#" index="x" delimiters=",">
                        <cfif first is true>
                            <cfoutput>
                                #x# = '#arguments.syl.##x##'
                            </cfoutput>
                            <cfset first = false>
                        <cfelse>
                            <cfoutput>
                                , #x# = '#arguments.syl.##x##'
                            </cfoutput>
                        </cfif>
                    </cfloop>
                WHERE id = '#arguments.syl.id#'
            </cfquery>

The error I get is with arguments.syl.##x##.  It says:

CFML variable name cannot end with a "." character

How can I format that to work correctly?
JMGibson3 - 28 Jun 2005 18:01 GMT
If you're trying to set it to the value of arguments.sysl.whatever, the
following should work:

#x# = '#Evaluate("arguments.syl." & x)#'

If it doesn't work (been awhile for me), set a var ahead of time and use that:
<cfset newVal = Evaluate("arguments.sys.#x#")>

#x# = '#newVal'
Stressed_Simon - 29 Jun 2005 08:11 GMT
You shouldn't use evaluate() here.

#x# = #arguments.syl[x]#

Is the correct way to use it!
Stefan K. - 29 Jun 2005 10:42 GMT
Originally posted by: Stressed_Simon
You shouldn't use evaluate() here.

#x# = #arguments.syl[x]#

Is the correct way to use it!
Seth Buntin - 29 Jun 2005 18:17 GMT
You are right Stressed_Simon.  Your solution worked.  The other one worked a couple of times but then didn't work so I tried yours and it was successful.

Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.