• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Setting variables in cfscript

Explorer ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

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 .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.
TOPICS
Advanced techniques

Views

259

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

Love ColdFusion Scope Structures. They are your friend:

Variables["vCovYear#i#"] = "SomeValue";

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 15, 2007 Mar 15, 2007

Copy link to clipboard

Copied

LATEST
Michael,

Thanks a lot. Works perfectly!!!

Anthony

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation