Hi All -

I am trying to do the following in my code.


<cfquery datasource="cfflex" name="q">

  SELECT 
    t1.account_id
  FROM 
    accounts1 AS t1
  LEFT JOIN accounts1 as t2 
  ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL
</cfquery>
                
<cfset treeData = arrayNew(1) />
<cfset vleafnodes = arrayNew(1) />

<cfloop query="q">
   <cfset vleafnodes[q.account_id] = q.account_id>
</cfloop>


<cfquery name="getRec" datasource="cfflex"> 
        SELECT account_id, name, acc_num, debit, credit, balance, parent_id 
FROM 
        accounts1 WHERE ...
</cfquery>

<cfloop query="getRec">
        <cfif getRec.account_id EQ vleafnodes[getRec.account_id]>
          <cfset vLeaf = true>
        <cfelse>
          <cfset vLeaf = false>
        </cfif>
       
</cfloop>

The array for the vleafnodes looks like below:
array
1       [undefined array element] Element 1 is undefined in a Java object of 
type   class coldfusion.runtime.Array.
2       [undefined array element] Element 2 is undefined in a Java object of 
type class coldfusion.runtime.Array.
3       3
4       4
5       [undefined array element] Element 5 is undefined in a Java object of 
type class coldfusion.runtime.Array.
6       6
7       7
8       8 

using isdefined or isarray to check if the element is defined in a particular 
position is not  helping during the comparision statement

<cfif getRec.account_id EQ vleafnodes[getRec.account_id]>

I keep getting the following error

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


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338042
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to