4 Replies Latest reply on Jul 19, 2009 1:19 PM by Flex harUI

    Simple e4x filter question

    happybrowndog

      For the life of me I just can't figure out why this does not work.

      Here is the variable of type XML called "datagrid":

      var datagrid:XML = <data>
        <record id="1" companyname="abc" password="pass1" isactive="Y"/>
        <record id="4" companyname="companyx" password="dog" isactive="Y"/>
        <record id="2" companyname="def" password="pass2" isactive="Y"/>
        <record id="3" companyname="ghi" password="pass3" isactive="Y"/>
        <record id="5" companyname="test" password="testpwd" isactive="Y"/>
        <record id="6" companyname="test2" password="testpwd2" isactive="Y"/>
        <record id="10" companyname="test3" password="testpwd3" isactive="Y"/>
        <record id="11" companyname="test4" password="pwd4" isactive="Y"/>
        <record id="12" companyname="test5" password="pwd5" isactive="Y"/>
      </data>;

       

      Here are a series of traces:

      trace(this.griddata.record[0]);
      trace(this.griddata.record[1]);
      trace(this.griddata.record[2]);
      trace(this.griddata.record[2].@id);
      trace(this.griddata.record.(@id=="5"));

      Only the 4th trace returns the value "2".  The rest of the traces return absolutely nothing when they should return some data.  The one in particular I'm interested in is the last one, which should return  <record id="5" companyname="test" password="testpwd" isactive="Y"/> .

       

      I've done a lot of e4x filtering and I can't see the difference between what I've done in the past successfully and this simple example now.  Is there something obvious I seem to be overlooking?