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.