Just a quick guess from what I remember when I've done stuff like this, try
putting your temp struct in the loop.

 <cfscript>
        
        Manifest=Replace(manifest, chr(09), ";", "ALL");
        ListFileLen=ListLen(Manifest,  "#chr(10)##chr(13)#");
                container = ArrayNew(1);
                        
                        for (y=1; y LTE ListFileLen; y=y+1)...;
                                ad = StructNew();       //Placing this here
allows it to be cleared each time.
ad.attribute_name="#ListGetAt(ListFileText, 2, ";")#";
                                        ad.ad_id="#ListGetAt(ListFileText,
3, ";")#";
                                        ad.display_text="Caption";
        
ad.attribute_cdata="#ListGetAt(ListFileText, 4, ";")#";
        
ad.startdate="#ListGetAt(ListFileText, 5, ";")#";
        
ad.stopdate="#ListGetAt(ListFileText, 5, ";")#";
                                
                        containerAds = ArrayAppend(container, ad);
        
                }
 </cfscript>

--------------
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA


-----Original Message-----
From: Owens, Howard [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 11:33 AM
To: CF-Talk
Subject: populate the damn array


OK, this probably something real stupid, but I'm not seeing it ... 

This code takes a tabbed file and is supposed to parse it into an array of
structures.

The problem is, the array is populating with 36 elements of the same data.
Whatever the last item in the file is, that because the repeated element ...
which means that each array append is overwriting previous data, or
something like that ... below is the complete code ... can anyone see what
the error is? Probably something simple and stupid:

 <cfscript>
        
        Manifest=Replace(manifest, chr(09), ";", "ALL");
        ListFileLen=ListLen(Manifest,  "#chr(10)##chr(13)#");
                container = ArrayNew(1);
                ad = StructNew();
                        
                        for (y=1; y LTE ListFileLen; y=y+1) {
                                ListFileText="#ListGetAt(Manifest, y,
"#chr(10)##chr(13)#")#";
        
ad.attribute_name="#ListGetAt(ListFileText, 2, ";")#";
                                        ad.ad_id="#ListGetAt(ListFileText,
3, ";")#";
                                        ad.display_text="Caption";
        
ad.attribute_cdata="#ListGetAt(ListFileText, 4, ";")#";
        
ad.startdate="#ListGetAt(ListFileText, 5, ";")#";
        
ad.stopdate="#ListGetAt(ListFileText, 5, ";")#";
                                
                        containerAds = ArrayAppend(container, ad);
        
                }
 </cfscript>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Owens
Internet Operations Coordinator
InsideVC.com/Ventura County Star
[EMAIL PROTECTED]
AIM: GoCatGo1956
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to