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 / March 2007



Tip: Looking for answers? Try searching our database.

Setting variables in cfscript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anthony Spears - 14 Mar 2007 20:43 GMT
I am parsing xml and I am trying to set each xml tag with the same name to a
different variable.  This is what I have.

COVYEAR = XmlSearch(myxmldoc, "//COVERED/YR_INFO/YEAR");
 
  for (i = 1; i LTE ArrayLen(COVYEAR); i = i + 1)
 
  vCOVYEAR = COVYEAR[i].XmlAttributes["VALUE"];

How do I add the "i" index to the variable vCOVYEAR so that each element in
the array  would be set to vCOVYEAR1, vCOVYEAR2, vCOVYEAR3, etc. etc.

Thanks in advance.
insuractive - 14 Mar 2007 22:33 GMT
Love ColdFusion Scope Structures.  They are your friend:

Variables["vCovYear#i#"] = "SomeValue";
Anthony Spears - 15 Mar 2007 15:35 GMT
Michael,

Thanks a lot.  Works perfectly!!!

Anthony
 
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



©2009 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.