Douglas (or anyone else that feels like following up)..

 

I’m trying to solve a specific problem currently that actually involves the Descendant Accessor (..).

 

 

I need to search a whole tree for a node with a specific node that has a specific attribute set to a specific value…

 

I have THAT CODE WORKING…  But I only NEED to get ONE such node each time I do the search (this is for a background task).

 

Is there any way to LIMIT the quantity that an XMLList should return?

 

 

Best Regards,

 

Steve

 

 

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Knudsen
Sent: Monday, September 25, 2006 10:51 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: XML issues

 

have a look at
http://livedocs.macromedia.com/flex/2/langref/XML.html
specifically the examples.

[EMAIL PROTECTED] is the pattern to see.  Nothing is buggy about it, use the E4X Luke!

DK

On 9/25/06, jnewport <[EMAIL PROTECTED]> wrote:

Thanks for your help so far.

Ok I have it working somewhat?  Here is my code and xml (sample).

Something funny was I couldn't get the <list> to work until I backed
out all the way to just <mx:List id="districtList"
dataProvider="{xmldpAddress}

then to <mx:List id="districtList" dataProvider="{xmldpAddress.month[0]}

then to <mx:List id="districtList"
dataProvider="{xmldpAddress.month [0].region}

so on and so forth.  I had to compile the app everytime walking my way
to <dataProvider="[EMAIL PROTECTED]>

Maybe flex is buggy?

Anyway, what I need to do now I am think is somehow convert my
xmldpAddress object to an Array or an ArrayCollection to populate my
datagrid, charts, and slider?  Or is there an easier way by just
leaving it as XML?  I have tried both

monthlyData=xmldpAddress as Array
monthlyData = event.result.list.month.source as Array;

but they don't work both show null.  I would rather not have to parse
my xml with several FOR (var i:number...etc) statements, but maybe
thats what it takes to turn my XML into an Array.


////////////////BEGIN CODE//////////////////////

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
    paddingTop="3"
    creationComplete="feedRequest.send()"
    pageTitle="Dashboard">

  <mx:Script>
        <![CDATA[
                import mx.rpc.events.ResultEvent;
            import mx.collections.ArrayCollection;



                [Bindable]
                private var xmldpAddress:XML;

                private function LoadXML(event:ResultEvent):void{
                        xmldpAddress = new XML( event.target.lastResult);

                        //need to put in error reporting and error catch here//
                }

        ]]>
  </mx:Script>

<mx:Style source="OSX.css"/>

        <mx:HTTPService id="feedRequest" url="" useProxy="false"
resultFormat="e4x" result="LoadXML(event)"/>
    <mx:Spacer height="1"/>

        <mx:ApplicationControlBar width="100%" height="37">
        <mx:Label text="Dashboard:"/>
        <mx:ComboBox width="150">
            <mx:dataProvider>
                <mx:Array>
                    <mx:String>Revenue Timeline</mx:String>
                </mx:Array>
            </mx:dataProvider>
        </mx:ComboBox>
        <mx:Spacer width="10"/>
        <mx:Label text="Select Period:"/>
        <mx:HSlider id="slider" width="180" thumbCount="2"
snapInterval="1" minimum="0"
                dataTipPlacement="bottom"/>
    </mx:ApplicationControlBar>

    <mx:HDividedBox width="100%" height="100%">
        <mx:HBox width="60%" height="100%">

                        <mx:Panel width="25%" height="100%">
                        <mx:List id="districtList"
dataProvider="[EMAIL PROTECTED]" width="100"
                                height="100%" resize="false" allowMultipleSelection="true"
dragEnabled="true"/>
                </mx:Panel>
                <mx:Panel id="ComparePanel" title="District Comparison"
width="75%" height="100%">
                        <mx:DataGrid id="dgMonthly"
dataProvider="{xmldpAddress.month.region}" width="100%" height="100%"
allowMultipleSelection="true" dragEnabled="true">
                                <mx:columns>
                                        <mx:DataGridColumn headerText="Column 1" dataField="name"/>
                                        <mx:DataGridColumn headerText="Column 2"
dataField="revenue"/>
                                </mx:columns>
                        </mx:DataGrid>
                        <!--<mx:LineChart id="chart"  showDataTips="true" width="100%"
height="100%">
                                <mx:horizontalAxis>
                                    <mx:CategoryAxis  categoryField="month"/>
                                </mx:horizontalAxis>

                                <mx:series>
                                    <mx:Array>
                                        <mx:LineSeries yField="apple" name="Apple"/>
                                        <mx:LineSeries yField="orange" name="Orange"/>
                                        <mx:LineSeries yField="banana" name="Banana"/>
                                    </mx:Array>
                                </mx:series>
                            </mx:LineChart>-->
                        </mx:Panel>
        </mx:HBox>
        <mx:VDividedBox width="40%" height="100%">
                <mx:Panel id="MonthlyTotal" title="Monthly Total" width="100%"
height="100%" />
                <mx:Panel id="CycelTotals" title="Cycle Totals" width="100%"
height="100%" />
        </mx:VDividedBox>
    </mx:HDividedBox>


</mx:Application>
///////////////END CODE/////////////////////////

///////////XML///////////////


<list>

    <month name="Jan-04" revenue="400263" average="80052">
        <region name="JC" revenue="46130"/>
        <region name="Marble" revenue="106976"/>
        <region name="Bert" revenue="79554"/>
        <region name="Cedar" revenue="39252"/>
        <region name="Bill" revenue="128351"/>
    </month>

    <month name="Feb-04" revenue="379145" average="75829">
        <region name="JC" revenue="70324"/>
        <region name="Marble" revenue="88912"/>
        <region name="Bert" revenue="69677"/>
        <region name="Cedar" revenue="59428"/>
        <region name="Bill" revenue="90804"/>
    </month>

<list>

////////////////END XML///////////////

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> It is not the XML structure.  Either of those two examples would be
> fine.
>
>
>
> Can you take this a step at a time?
>
>
>
> Can you get data into a datagrid at all?  I don't do much charting, but
> can the line chart use the same dataProvider that the data grid does?
> Hard code a sample XML structure into an XML variable.
>
>
>
> Structure your code so that the two controls are bound to a global
> variable dataProvider, probably an XMLListCollection.  Code a function
> that uses an e4x _expression_ against the XML variable to set the value of
> that collection (use the collection API).
>
>
>
> The slider dataProvider needs to ba a different var. A different e4x
> _expression_ can return that collection or XMLList from the same base XML
> data  On the change event of the slider, call the function that uses the
> e4x _expression_ to set the dataProvider for the grid and chart, filtering
> for the data you want.
>
>
>
> You haven't said what problems you have been having. Or posted any code,
> so I can't be more specific.
>
>
>
> What debugging techniques do you have available?
>
>
>
> Tracy
>
>
>
> ________________________________
>
> From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On
> Behalf Of jnewport
> Sent: Friday, September 22, 2006 4:00 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] XML issues
>
>
>
> Ok, I have just wasted an entire week.....and I think I am going to go
> insane. I have read every livedoc, flex doc and still no solution is
> working.
>
> Either the issue is my XML structure (though tried several)
> Or its my code or could be both.
>
> Below are both xml structures. What I am trying to do is use the data
> (via a httpService) in BOTH a datagrid and linechart. And tie the
> datagrid and linechart to a slider. So I can map out the data for
> each state on a chart for the year and then let the slider control the
> months shown on the datagrid and linechart. I can't seem to pull the
> data out of the xml and use it to populate the datagrid, line chart,
> and slider. I tried e4x and bringing the data.xml file into an array
> like the example Adobe dashboard example. I would prefer not having
> to parse through the xml file and create several arrays for each
> region in the xml file unless I have to. I tried the new dot
> notation, but then I had issue with the slider and trying to convert
> the xml object into an array to populate the slider.
>
> What is the best format for xml and what is the easiest way to
> populate the datagrid, slider, and linechart?
>
> [First Try XML]
> <list>
> <month name="Jan-04" revenue="400263" average="80052">
> <region name="Maine" revenue="46130"/>
> <region name="Nebraska" revenue="106976"/>
> <region name="Montana" revenue="79554"/>
> <region name="Texas" revenue="39252"/>
> <region name="Kansas" revenue="128351"/>
> </month>
>
> <month name="Feb-04" revenue="379145" average="75829">
> <region name="Maine" revenue="70324"/>
> <region name="Nebraska" revenue="88912"/>
> <region name="Montana" revenue="69677"/>
> <region name="Texas" revenue="59428"/>
> <region name="Kansas" revenue="90804"/>
> </month>
> </list>
>
> [Second Try XML]
> <list>
> <month name=Jan-04>
> <state>
> <name>Maine</name>
> <revenue>34343</revenue>
> </state>
> <state>
> <name>Nebraska</name>
> <revenue>23232</revenue>
> </state>
> <state>
> <name>Montana</name>
> <revenue>66666</revenue>
> </state>
> </month>
> <month name=Feb-04>
> <state>
> <name>Maine</name>
> <revenue>11343</revenue>
> </state>
> <state>
> <name>Nebraska</name>
> <revenue>29932</revenue>
> </state>
> <state>
> <name>Montana</name>
> <revenue>55644</revenue>
> </state>
> </month>
> </list>
>





--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED]
    mailto: [EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/






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

__._,_.___

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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to