Skip navigation
Daniel Cantin
Currently Being Moderated

Using findAny cursor method

Mar 18, 2013 7:13 AM

I am using a sort and an IviewCursor to find data in arrayCollection. My goal is to find all lines in the arrayCollection matching a specific combination of keys. So I use the findAny method of my cursor to do it. As I can see in debug mode only the last occurrence of my keys combination trigger the function code of my listener.

 

Here is my code:

 

var data:Object              = DataGridListData(listData);

var indicePaire:int          = new int();

var startDate:Date           = null;

var totLigne:String          = new String();

var pairesSort:Sort          = new Sort();

var pairesCursor:IViewCursor = this.document.lesPairesWork.createCursor();

var initConfirme:String      = "1";

var myKostl:String           = "1";

                   

theIndice  = event.currentTarget.id.substr(event.currentTarget.id.length-1,1);

startDate  = lasseUtiGenerale.trsfStringToDate(this.document.formatDate, this.document.dateDebutFLEX);

dateTraite = dateField.dateToString(classeUtiGenerale.dateMouvement(startDate,theI ndice),"YYYYMMDD");

dateTraiteSAP        = dateTraite;

                   

data                 = data.item;

noMatriculePaires    = data["Matricule"];

totLigne             = data["TypeLigne"];

 

this.document.pairesTempsOri.removeAll();

 

pairesSort.fields = [ new SortField( "PernrChar", true ), new SortField( "ZcatsdateChar", true ), new SortField( "Statut", true ),  new SortField( "StatutKostl", true ) ];

                   

this.document.lesPairesWork.sort = pairesSort;

                   

this.document.lesPairesWork.refresh();

 

pairesCursor.addEventListener( FlexEvent.CURSOR_UPDATE, addPaireHeures );

                   

pairesCursor.findAny( { PernrChar:noMatriculePaires, ZcatsdateChar:dateTraite, Statut:initConfirme, StatutKostl:myKostl } );

 

I am not an expert of Flex and maybe I am not using the good way to get what I want.

 

Help required.

 

Regards,

 
Replies
  • Currently Being Moderated
    Mar 20, 2013 9:01 AM   in reply to Daniel Cantin

    Trying see if I understand your issue.  When you use findAny, you get the same result each time?

    You will always only get 1 item returned.

     

    findAny(values:Object):Boolean

    Finds an item with the specified properties within the collection and positions the cursor to that item.

    findFirst(values:Object):Boolean

    Finds the first item with the specified properties within the collection and positions the cursor to that item.

    findLast(values:Object):Boolean

    Finds the last item with the specified properties within the collection and positions the cursor on that item.

     

    If you want to find all the items, you probably need to use the Bookmark and Seek functions to move through the cursor until you get to the end.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points