2 Replies Latest reply on Dec 27, 2007 10:28 AM by ntsiii

    dynamic e4x

    Meldrek
      Hi,

      I have a little problem while trying to generate dynamic e4x queries ... Well, basically, I don't know how to do that.

      Here's an explanation of what I'd like to get.

      I have a Repeater containing ComboxBoxes, the dataprovider of the repeater is an E4X
      <buildingcat id="1">Apartment</buildingcat>
      <buildingcat id="2">House</building>
      ...
      I also have various TextInputs in that component (Maximum price, surface ...). The whole thing is a building search engine.

      Next to that, I have a TileList with all my buildings (the search results) also in e4x.
      <building id="1">
      <category id="1"/>
      <location>New York</location>
      <price>5000000</price>
      </building>

      The user can check several checkboxes and enter a maximum price for example.
      I'd like to filter the search so that only the buildings matching the search criteria are displayed.

      For example, I'd like to see the building matching these criteria :
      - Apartment OR House OR Penthouse
      - AND Maximum price = 100000000

      I don't see how to generate dynamic e4x queries. Could you please help me with that one ?

      Many thanks
        • 1. Re: dynamic e4x
          mae@ccg Level 1
          For starters, I'd use an arraycollection as the dataprovider for the tile list. then you get to use the filterfunction to filter it.

          e4x can do it, but given the complexity you lay out, actionscript will be simpler.

          hope that helps.
          • 2. Re: dynamic e4x
            ntsiii Level 3
            A technique that can simplify complex e4x queries is to do the logic in a function, instead of in-line in the e4x expression.

            var xlStructures:XMLList = xmlData.structure.(checkStruc(*.parent()));

            private function checkStruc(xmlStructure:XML):Boolean
            {
            ..do your logic here, return true or false
            }

            note also that you can construct dynamic expressions using the variables:
            var sCatId:String = "1";
            var xlStructures:XMLList = xmlData.structure.(@id==sCatId);

            Tracy