Skip to main content
Known Participant
August 24, 2009
Question

cfloop over array

  • August 24, 2009
  • 1 reply
  • 1434 views

I am looping over an array It works fine if all variables are declared in array, I am trying to skip the entire process even if one variable is not declared I tried using isdefined, I tried to use cftry and cfcatch... nothing working any suggestions......

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 24, 2009

    trim each element and check to see if the length is greater than 0.

    Do this before you even create and populate the array.

    Known Participant
    August 24, 2009

    It gives this kind of error  when I am trying to check the length

    Element 7 is undefined in a Java object of type class coldfusion.runtime.Array.

    The error occurred in E:\www\test\codes.cfm: line 727
    725 :                     <td>#da[1]#</td>
    726 :                     <td>
    727 :                     <cfset done = #trim(ca)#>
    728 :                     <cfif Len(done) is 0>
    729 :                     hi
    
    ilssac
    Inspiring
    August 24, 2009

    That error is telling you that you are referencing the 7th element of a 6 element array.

    I.E. ca[7] does not exist.