Michael Dinowitz wrote:
> I think that a new array search function might be in order here. Something to
> look through an array for a value and return its index.
> 
>>I'm not sure what you are really trying to accomplish here. 

I agree with matt, are you working on the maketree tag in cf? lets talk 
examples...

do you modify the array, ( ie inserting or deleting array members other 
than from the end?) if not then u could index the array using structures

<cfscript>
     item_array=ArrayNew(1);
     item_struct=StructNew();
</cfscript>

<cfloop query="qry_items">
        <cfscript>
                x=arraylen(item_array);
                item_array[x]=qry_item.item;
                item_struct[qry_item.item]=x;
        </cfscript>
</cfloop>

find where dog is in the array = item_struct["dog"] or item_struct.dog

this method is so fast scaling the dataset makes almost no difference in 
speed

now you can always find the position of x in the array using the struct,
this of course doesn't handle very well adding elements to the aray

ideally I would try to eliminate arrays all together... esp when u 
consider that have 2 values in a struct, the key and the value

z

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to