I thought this solution looked correct by an expert, but I am getting the error in the subject line. I added the sort, but it doesn't seem to help. Basically I am trying to push the contents of currentAc2Object into ac1 (make it a part of the currentAc1Object). The marketingPromoCode & sourceCode is what I am making the match on.
The data in the two ArrayCollections come from two different data sources, but I want to display them on one row in a datagrid.
Anyways, why does it even fail on sort? I haven't seen one example on google where they were using getItemIndex and it needed to sort. or addItemAt. Whether I have that sort there or not, I get the same error....
Error: Find criteria must contain at least one sort field value.
var ac1:ArrayCollection = this._reportProxy.allPromoData;
var ac2:ArrayCollection = analyticsView.reports;
var sort:Sort = new Sort();
sort.fields = [new SortField("marketingPromoCode", true)];
ac1.sort = sort;
trace("received promo data");
for(var h:int; h < ac1.length; h++)
for(var k:int; k < ac2.length; k++)
if(ac1[h].marketingPromoCode == ac2[k].sourceCode)
trace("Match " + ac2[k]); //Returns a ReportVO object
ac1.addItemAt( ac2[k], h );