Solved

Find criteria must contain at least one sort field value.

Posted on 2009-04-08
7
3,120 Views
Last Modified: 2013-11-11
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.
at mx.collections::Sort/findItem()
at mx.collections::ListCollectionView/http://www.adobe.com/2006/flex/mx/internal::findItem()

var currentAc1Object:Object;
var currentAc2Object:Object; 
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;
ac1.refresh();
 
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 );
        trace("Finish");
         break;
      }
   }
}

Open in new window

0
Comment
Question by:hallikpapa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 24104260
Are the ArracyCollections empty? Can you put the sort code inside an if condition that checks the length of the ArrayCollection..
0
 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 24106243
The error might come from this code line:

>>    if(ac1[h].marketingPromoCode == ac2[k].sourceCode)

What kind of object's are 'marketingPromoCode' and 'sourceCode'? Just String's? Or instances of some custom class?

0
 

Author Comment

by:hallikpapa
ID: 24107399
No they aren't empty. and those two fields I am comparing against are strings. I will try putting the sort inside an if to see what happens
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:zzynx
ID: 24107486
>> Error: Find criteria must contain at least one sort field value.
>> at mx.collections::Sort/findItem()
>> at mx.collections::ListCollectionView/http://www.adobe.com/2006/flex/mx/internal::findItem()

Any line beneath these in the stack trace that refer to your own code?
0
 

Author Comment

by:hallikpapa
ID: 24130129
Sorry about the delay. But here is the final answer I came up with.
var currentAc1Object:Object;
					var currentAc2Object:Object; 
					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;
					ac1.refresh();
					sort.fields = [new SortField("sourceCode", true)];
					ac2.sort = sort;
					ac2.refresh();
 
					for(var h:int; h < ac2.length; h++)
					{
					   for(var k:int; k < ac1.length; k++) 
					   {
					   	  if(ac2[h].sourceCode == ac1[k].marketingPromoCode)
					      {
					      	ac2[h].eventLog = ac1[k];
					         break;
					      }
					   }
					}

Open in new window

0
 

Author Comment

by:hallikpapa
ID: 24130137
I just created a property in the Value Object called eventLog, and made it an instance of another value object.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24135478
Thanx 4 axxepting
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Action Script commands 3 222
Adobe Flash Player : screen freezes for a few GUI & Rdp 5 646
Accessing Live Dynamic Stream 6 207
Begin mp4 video on first frame 6 184
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question