Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Cfloop..

    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?



    Seth Buntin Guest

  2. Similar Questions and Discussions

    1. cfloop
      The goal is to insert a record into table 'atd', which contains a document id and an associate id, for each document (38) and associate (150). So...
    2. cfloop error
      I am getting an error that is resolving to the closing tag for the </cfloop>. Any Ideas? <cfoutput query="Recordset1" group="category"> <table...
    3. <cfloop> question
      The code below generates a list of form fields for my form. I've been asked to see if it's possible to skip a line after every two form fields. Is...
    4. to cfloop or not to cfloop?
      :confused; I have a list of checkboxes from a form, and a submit button for "Batch Print" The var is "SelectList" and comes out as comma dilimited....
    5. CFLOOP/CURRENTROW
      I have a LOOP that runs over a query and I use CURRENTROW so that I can then use MOD on it so I can utilize repeating ARRAY data to change the color...
  3. #2

    Default Re: Cfloop..

    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'


    JMGibson3 Guest

  4. #3

    Default Re: Cfloop..

    You shouldn't use evaluate() here.

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

    Is the correct way to use it!
    Stressed_Simon Guest

  5. #4

    Default Re: Cfloop..

    Originally posted by: Stressed_Simon
    You shouldn't use evaluate() here.

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

    Is the correct way to use it!


    Stefan K. Guest

  6. #5

    Default Re: Cfloop..

    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.
    Seth Buntin Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139