If the data is dynamic and especially fetched from the database the no. of 
children may not be known. Yes if it is E4X, we can dig through the XML path 
and specify it directly but there are places where looping cannot be avoided.
The sample in the specified URL has looping too...


            for each (var num:XML in [EMAIL PROTECTED]) {

                trace(num);                             // 123-123-1234

            }                                           // 789-789-7890




________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Knudsen
Sent: Friday, September 05, 2008 4:14 PM
To: [email protected]
Subject: Re: [AFFUG Discuss] Selective Data in a Data Grid

e4x?  no looping needed
http://livedocs.adobe.com/flex/3/langref/XML.html
see this URL for some examples.

Also, if you put this data into a ArrayCollection of some sort of objects, 
hopefully you use typed ones, you can use the filtering methods of 
ArrayCollection class.

DK


On Fri, Sep 5, 2008 at 4:06 PM, Raj, Senthil <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

The XML can be filtered the following way.



private var faq:XML = <FAQS>

                           <FAQ id="1" isHeader="1" question="About Flex" 
answer="" />

                           <FAQ id="2" isHeader="0" question="What is the 
Purpose?" answer="To be awesome" />

                           <FAQ id="3" isHeader="0" question="Who should use 
it?" answer="Everyone!" />

                           <FAQ id="4" isHeader="1" question="About 
Chattanooga" answer="" />

                           <FAQ id="5" isHeader="1" question="About the Mets" 
answer="" />

                           <FAQ id="6" isHeader="1" question="About Donkeys" 
answer="" />

                           <FAQ id="7" isHeader="1" question="About Penguins" 
answer="" />

                        </FAQS>;



.........



                        for each (var item:XML in faq.children()){

                              if ([EMAIL PROTECTED] == "0") {

                                    mx.controls.Alert.show("success "+ [EMAIL 
PROTECTED]);

                              }

                        }



________________________________

From: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> [mailto:[EMAIL 
PROTECTED]<mailto:[EMAIL PROTECTED]>] On Behalf Of Lucas Golden
Sent: Friday, September 05, 2008 3:42 PM
To: [email protected]<mailto:[email protected]>
Subject: [AFFUG Discuss] Selective Data in a Data Grid



I'm grabbing data from an XML file and am wanting to only display certain nodes 
in a Datagrid based on a particular value of the XML Node.

I've converted the XML over to an ArrayCollection so I can access particular 
properties of the XML node, I'm just having problems excluding data from it.

I'm working on a way to change around the XML (dynamically created from a 
Database) to see if I can do some array manipulation as a work around, but it'd 
be nice if I could just exclude it.


So, for instance, if I had the following XML:


<FAQS>
   <FAQ id="1" isHeader="1" question="About Flex" answer="" />
   <FAQ id="2" isHeader="0" question="What is the Purpose?" answer="To be 
awesome" />
   <FAQ id="3" isHeader="0" question="Who should use it?" answer="Everyone!" />
   <FAQ id="4" isHeader="1" question="About Chattanooga" answer="" />
   <FAQ id="5" isHeader="1" question="About the Mets" answer="" />
   <FAQ id="6" isHeader="1" question="About Donkeys" answer="" />
   <FAQ id="7" isHeader="1" question="About Penguins" answer="" />
</FAQS>


>From that XML file, I only want to display the nodes that have a "isHeader" 
>value of 0.

Thanks!
Luke Golden

-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by FusionLink<http://www.fusionlink.com>
-------------------------------------------------------------

-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by FusionLink<http://www.fusionlink.com>
-------------------------------------------------------------



--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?

-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by FusionLink<http://www.fusionlink.com>
-------------------------------------------------------------



-------------------------------------------------------------

To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line



For more info, see http://www.affug.com

Archive @ http://www.mail-archive.com/discussion%40affug.com/

List hosted by http://www.fusionlink.com

-------------------------------------------------------------

Reply via email to