Skip to main content
October 11, 2007
Answered

Dynamic variable naming error

  • October 11, 2007
  • 1 reply
  • 322 views
Hi,


Can someone help me dynamically naming and populating arrays ? The attached code gives me the following error message:
The string "application.label.details[1]" is not a valid ColdFusion variable name.

What's wrong with it ? Thanks.


    This topic has been closed for replies.
    Correct answer cf_dev2
    Use array notation

    <cfset application.label[qLabels.DisplayContext] = ArrayNew(1)>
    ...
    <cfset application.label[qLabels.DisplayContext][qLabels.currentRow] = qLabels.Label>

    1 reply

    cf_dev2Correct answer
    Inspiring
    October 11, 2007
    Use array notation

    <cfset application.label[qLabels.DisplayContext] = ArrayNew(1)>
    ...
    <cfset application.label[qLabels.DisplayContext][qLabels.currentRow] = qLabels.Label>
    October 12, 2007
    Hi cf_dev2,

    Thank you pointing me to the right direction. I appreciate.

    Link : Referencing complex structures