11 Replies Latest reply on Aug 14, 2013 1:12 PM by Carl Von Stetten

    Test for specific array position?

    richardELeach Level 1

      Hi

       

      I have a 2 dimensional array stored in sessions scope:

           <cfset Session.POarCart=#arrayNew(2)#>

       

      and it can have as many as 7 elements (for example):

           Session.POarCart[1][1]

           Session.POarCart[1][2]

           Session.POarCart[1][3]

           Session.POarCart[1][4]

           Session.POarCart[1][5]

           Session.POarCart[1][6]

           Session.POarCart[1][7]

       

      ... however elements 6 and 7 (Session.POarCart[1][6] and Session.POarCart[1][7]) don't always get filled (or populated, or set, whatever the nomenclature....)

       

      Does anyone know how to check if a specific array element "contains something"? "is not null"? "has length"? I can test that the array exists, and it does, but I don't know how to test for the exact position of the array.

       

      My code is failing when I attempt to reference Session.POarCart[1][6] because it doesn't contain anything.

       

      Anyone?

       

      Thanks,

       

      Rich