I got it
var isNew:Boolean = true;
function addfromIS():Void {
         var SrcItem:String = IS_RESULTS.dataProvider[IS_RESULTS.selectedIndex].PERSON_ID;
            isNew = true;
            if (SelectionList.length>0) {
                 for (var i = 0; i<SelectionList.length; i++) {
                         var CompItem:String = Person_List.dataProvider[i].PERSON_ID;
                         if (SrcItem == CompItem) {
                                 isNew = false;
                         }
                 }
         }
         if (isNew) {
                 Person_List.dataProvider.addItem(IS_RESULTS.dataProvider[IS_RESULTS.selectedIndex]);
         }
}
The key was getting the info through the datagrid instead of directly from the dataProvider.  I have absolutely no idea why.  If anyone can shed light on this for me it would be apreciated.  This is only the 3rd day I've been working with Flex, and with no prior education on Flex. :)

jeff tapper wrote:
try this =

var SelectionList:Array = new Array();
var isNew:Boolean = true;
function addfromIS():Void {
         var SrcItem =
IS_RESULTS.dataProvider.getItemAt(IS_RESULTS.selectedIndex);
         if (SelectionList.length>0) {
                 for (var i = 0; i<SelectionList.length; i++) {
                         var CompItem = SelectionList.getItemAt(i);
                         if (SrcItem.Person_ID != CompItem.Person_ID) {
                                 isNew = false;
                         }
                 }
         }
         if (isNew) {
                 SelectionList.addItem(SrcItem);
         }
}


At 11:25 AM 9/16/2005, you wrote:
>I forgot to say exacty what I need.  I have 2 datagrids and need to move
>rows from one to another making sure that the destination doesn't already
>have the same row.  Could someone look at the code I have and see why the
>check for duplicates isn't working?
>
>tnks
>
>Greg Johnson wrote:
>>I have 2 Datagrids.  One gets populated by a call to a CFC, the other
>>starts databound to an empty array
>>
>>The Source Datagrid has a list of names.  I let the person click on,
>>then click a button.  Then a function checks to make sure the person is
>>not already in the list.  If they are not in the list, it adds them to
>>the list.
>>
>>Both have a structure of
>>PERSON_ID
>>FULL_NAME
>>DEPT_CODE
>>DEPT_NAME
>>
>>The comparison is on PERSON_ID which is a unique number stored in the
>>SQL Database as test. SelectionList is bound to the destination Datagrid
>>and here is the function that brings in the data for the source grid.
>>
>>private function doResultGetPeople(result:Array):Void{
>>     var TempObject:Object = new Object();
>>     var GetPeopleArray:Array = new Array();
>>     for(var i=0; i < result.length; i++){
>>      TempObject = result[i];
>>      GetPeopleArray.push(TempObject);
>>     }
>>     IS_RESULTS.dataProvider = GetPeopleArray;
>>     Selections.visible=true;
>>    }
>>
>>Here is my code that is always evaluating true
>>
>>var SelectionList:Array = new Array();
>>function addfromIS():Void {
>>     var SrcItem =
>>IS_RESULTS.dataProvider.getItemAt(IS_RESULTS.selectedIndex);
>>     if(SelectionList.length > 0) {
>>         for (var i=0; i<SelectionList.length; i++) {
>>             var CompItem = SelectionList.getItemAt(i);
>>              if(SrcItem.Person_ID != CompItem.Person_ID) {
>>                 SelectionList.addItem(SrcItem);
>>             }
>>         }
>>     } else {
>>         SelectionList.addItem(SrcItem);
>>     }
>>}
>>
>>--
>>Greg Johnson
>>Owner & Lead Technician
>><mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
>>
>>Techno-Fix-It
>>Filling the Gap Between the Store and the Repair Shop
>>----------------------
>><http://www.technofixit.com>www.technofixit.com
>>Phone:(919)-371-1476
>>Fax:(919)-882-9804
>>P.O. Box 1094
>>Morrisville, N.C. 27560
>>
>>
>>
>>
>>----------
>>As a professional in computers, I personaly recommend Avast Antivirus
>><http://www.avast.com>avast! Antivirus: Inbound message clean.
>>
>>Virus Database (VPS): 0537-2, 09/16/2005
>>Tested on: 9/16/2005 9:56:11 AM
>>avast! - copyright (c) 2000-2004 ALWIL Software.
>
>
>--
>Greg Johnson
>Owner & Lead Technician
><mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
>
>Techno-Fix-It
>Filling the Gap Between the Store and the Repair Shop
>----------------------
><http://www.technofixit.com>www.technofixit.com
>Phone:(919)-371-1476
>Fax:(919)-882-9804
>P.O. Box 1094
>Morrisville, N.C. 27560
>
>--
>Flexcoders Mailing List
>FAQ:
><http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>Search Archives:
><http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
>
>----------
>YAHOO! GROUPS LINKS
>
>    *  Visit your group
> "<http://groups.yahoo.com/group/flexcoders>flexcoders" on the web.
>    *
>    *  To unsubscribe from this group, send an email to:
>    *
> <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
>
>    *
>    *  Your use of Yahoo! Groups is subject to the
> <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>
>
>----------




As a professional in computers, I personaly recommend Avast Antivirus
avast! Antivirus: Inbound message clean.

Virus Database (VPS): 0537-2, 09/16/2005
Tested on: 9/16/2005 12:10:20 PM
avast! - copyright (c) 2000-2004 ALWIL Software.



-- 
Greg Johnson
Owner & Lead Technician
[EMAIL PROTECTED]

Techno-Fix-It
Filling the Gap Between the Store and the Repair Shop
----------------------
www.technofixit.com
Phone:(919)-371-1476
Fax:(919)-882-9804
P.O. Box 1094
Morrisville, N.C. 27560


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to