1 Reply Latest reply on Feb 3, 2009 6:23 AM by Newsgroup_User

    E4X Filter Mystery in AS Class

    KUZELJ Level 1
      Hi,
      I have a very mysterious behaviour when I try to filter an XML - depending on the place where I apply the filter expression.
      The app should show a datagrid that displays a XML that can be filtered via a combobox.

      I have attached 2 code examples. The first one shows all the code cramped into one single mxml file
      while the other one shows the filtering code being moved outside into a AS class for capsuling reasons.
      The interesting part on the AS class is that as soon as I want to apply a filter expression to the XML
      variable "source_" it delivers me an empty result set.
      Even if I create a static filter expression something like "source_.Statement.(@division=='A')" -
      the result is always an empty result set.
      I am completely stunned.
        • 1. Re: E4X Filter Mystery in AS Class
          Level 7

          "KUZELJ" <webforumsuser@macromedia.com> wrote in message
          news:gm6v96$b2c$1@forums.macromedia.com...
          > Hi,
          > I have a very mysterious behaviour when I try to filter an XML - depending
          > on
          > the place where I apply the filter expression.
          > The app should show a datagrid that displays a XML that can be filtered
          > via a
          > combobox.
          >
          > I have attached 2 code examples. The first one shows all the code cramped
          > into
          > one single mxml file
          > while the other one shows the filtering code being moved outside into a
          > AS
          > class for capsuling reasons.
          > The interesting part on the AS class is that as soon as I want to apply a
          > filter expression to the XML
          > variable "source_" it delivers me an empty result set.
          > Even if I create a static filter expression something like
          > "source_.Statement.(@division=='A')" -
          > the result is always an empty result set.
          > I am completely stunned.

          First, if you used an XMLListCollection, you could just use its
          filterFunction and not have to go through so many convolutions--the logic
          would already be encapsulated in a class that Adobe was nice enough to
          create for you that has been through QA and everything.

          Second, what has the debugger told you about what's going on?