XMLListCollection

Hello all you Flexers...
I have a bunch of data in an XMLListCollection. The
collection has 3 levels to it: Table or View is the top level,
followed by table / view name, followed by field name.
This data in the collection is being used in a checked tree
control. Each of the field names can be checked or unchecked. When
the user presses an update button I need to be able to send the
date in the XMLListCollection (as seen by the tree control) back to
ColdFusion.
My question is what is the best method for returning data
from a XMLListCollection to ColdFusion and how would I format the
data??? I.E. should I loop through the XMLListCollection (how do I
do that???) to populate an array and then send the array back to
CF???
Oh a little code snippet would be appreciated too!!! :)
Have an Ordinary Day...
KomputerMan ~|:-)

Just send it as a string and manipulate the XML on the CF
side.
I would make sure you have a root tag, though since handling
collections of xml nodes can be tricky in many languages.
var sXML:String = "<root>;
sXML += myXMLListCollection.toXMLString();
sXML += "</root>;
var oRequest:Object = new Object();
oRequest.xmlstring = sXML;
myHTTPService.send(oRequest);
Tracy

Similar Messages

  • How to Find the Index of Element in the XMLListCollection

    Hi,
    I have a burning question here, and I wonder if anyone has tried to do this.
    I have an XML file that is read into the xml collection, and for each of the names that appear in the file (pre-declared somewhere else) , I tried to remove the element.
      However, it either gives me -1, if I do trace(slc.getItemIndex(xml.@name).toString()); when they exist, or tell me #3594 as shown in the error below:
    Here is the code:
    private function checkBox_change(event:Event):void{    
               xlc = new XMLListCollection(searchResult..book);  
                   len = searchResult..publisher.length();              
                   for (idx=0;idx<len; idx++) {
                       if (checkBox[idx].selected == false) {                          
                               for each (name in input_name2) {  
                               for each (xml in xlc){
                               if ((xml.@name == checkBox[idx].label) && (xml.@pub == name)){    
        trace(xml.getItemIndex(xml.@name).toString());
        //I get an error that says 3594: getItemIndex is not a recognized method of the dynamic class XML.                            
    Could anyone please give me some pointers on how to remove the desired element? I do know how to use splice.
    Thanks for your help.
    Alice

    Alice you could do something like this
    delete myXML.(@ISBN=="4689997865")
    Sincerely,
    Michael
    El 04/05/2009, a las 11:54, alice_data <[email protected]> escribió:
    >
    Hi,
    >
    I have a burning question here, and I wonder if anyone has tried to 
    do this.
    I have an XML file that is read into the xml collection, and for 
    each of the names that appear in the file (pre-declared somewhere 
    else) , I tried to remove the element.
    >
      However, it either gives me -1, if I do 
    trace(slc.getItemIndex(xml.@name).toString()); when they exist, or 
    tell me #3594 as shown in the error below:
    >
    Here is the code:
    >
    private function checkBox_change(event:Event):void{
               xlc = new XMLListCollection(searchResult..book);
                   len = searchResult..publisher.length();
                   for (idx=0;idx<len; idx++) {
                       if (checkBox[idx].selected == false) {
                               for each (name in input_name2) {
                               for each (xml in xlc){
                               if ((xml.@name == checkBox[idx].label) && 
    (xml.@pub == name)){
        trace(xml.getItemIndex(xml.@name).toString());
        //I get an error that says 3594: getItemIndex is not a 
    recognized method of the dynamic class XML.
    >
    >
    Could anyone please give me some pointers on how to remove the 
    desired element? I do know how to use splice.
    Thanks for your help.
    >
    Alice
    >

  • How to filter duplicates from XMLListCollection

    I have been trying to filter duplicates from XMLListCollection using FilterFunction.  However, it filters on the main XML tag, which happens to be the same value on all tags in this particular XML.  The values only vary in the parameters, and I need to filter the duplicates on one of them.  Is there any way to do that?

    yep, there are several ways out there
    The easy oneDo not add duplicates to the XMLListCollection
    Complicated one, extend XMLListCollection with Boolean property 'strict', override method addItemAt and trace duplicates in there.
    Super easy one is to drop XMLListCollection usage in favor of Dictionary class, it's natural capabilities will allow you to maintain strict rule for your data, just use distiction property as a key value with Dictionary class, and you are done

  • Advanced Datagrid GroupingCollection of flat data (XMLLISTCollection) while sorting throws exception

    HI,
         Iam using AdvancedDatagrid inorder to group the flat data populated from the backend through BlazeDS. Result data will be in xml format and i have converted it to xmllistcollection and assigned to the grouping collection source. Flat data is grouped by one of the attribute called 'Name' and refreshed after data has been populated.
    Data structre used as input is: WIth this structure, iam grouping by the field 'Name'.
      <Report> <att_report>
      <id>FDR1</id>
      <Name>Feeder 1</Name>
      <frequency>Monthly</frequency>
      <Field>Finance 1</Field>
      <Aug_10>100</Aug_10>
      <Jul_10>200</Jul_10>
    </att_report>
    <att_report>
      <id>FDR1</id>
      <Name>Feeder 1</Name>
      <frequency>Yearly</frequency>
      <Field>Finance 2</Field>
      <Jul_10>200</Jul_10>
    </att_report>
    <att_report>
      <id>FDR2</id>
      <Name>Feeder 2</Name>
      <frequency>Quarterly</frequency>
      <Field>Finance 3</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    <att_report>
      <id>FDR2</id>
      <Name>Feeder 2</Name>
      <frequency>MOnthly</frequency>
      <Field>Finance 2</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    <att_report>
      <id>FDR4</id>
      <Name>Feeder 4</Name>
      <frequency>yearly</frequency>
      <Field>Finance 5</Field>
      <Jul_10>2000</Jul_10>
    </att_report>
    </Report>
    Grouping is done as expected. We have additional functionalities like soring / seraching of the result set. Either one is working fine. Other functionality throws excpetion mentioned below.
    When any of the advanced datagrid grid column header is clicked for sorting, it throws exception. I have pasted the exception below for reference.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.collections::HierarchicalCollectionView/internalRefresh()[C:\work\flex\dmv_automation\ projects\datavisualisation\src\mx\collections\HierarchicalCollectionView.as:709]
    at mx.collections::HierarchicalCollectionView/refresh()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\collections\HierarchicalCollectionView.as:686]
    at mx.controls::AdvancedDataGridBaseEx/sortHandler()[C:\work\flex\dmv_automation\projects\da tavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:6869]
    at mx.controls::AdvancedDataGrid/sortHandler()[C:\work\flex\dmv_automation\projects\datavisu alisation\src\mx\controls\AdvancedDataGrid.as:6899]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls::AdvancedDataGrid/headerReleaseHandler()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\controls\AdvancedDataGrid.as:7120]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.controls::AdvancedDataGridBaseEx/mouseUpHandler()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:5738]
    at mx.controls::AdvancedDataGrid/mouseUpHandler()[C:\work\flex\dmv_automation\projects\datav isualisation\src\mx\controls\AdvancedDataGrid.as:8457]
    I tried with couple of options but still not able to get rid of the excpetion. I browsed through couple of links also, still not able to find an solution. Can i know whether it is a bug or it can be fixed.
    Any help / suggestions on this will be great.
    Thanks in Advance,
    Srinivasan

    Read the error messages and pay attention to the line number of the error:
    1)1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile()
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    Test.java:7: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
        FileOutputStream f = new FileOutputStream("data.txt");
                             ^
    1 error2)1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    Test.java:12: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
        openFile();
                ^
    1 error3)
    1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args)
    11   {
    12     try
    13     {
    14       openFile();
    15     }
    16     catch(FileNotFoundException e)
    17     {
    18       System.out.println("Error file doesn't exist.");
    19     }
    20   }
    21 }
    $ javac -cp "" Test.java
    $
    1 import java.io.*;
    2
    3 public class Test
    4 {
    5   public static void openFile() throws FileNotFoundException
    6   {
    7     FileOutputStream f = new FileOutputStream("data.txt");
    8   }
    9
    10   public static void main (String[] args) throws FileNotFoundException
    11   {
    12     openFile();
    13   }
    14 }
    $ javac -cp "" Test.java
    $

  • Why is it different using ArrayCollection and XMLListCollection?

    As shown in the screenshot below. The first one has ArrayCollection as dataProvider. The second one has XMLListCollection as dataProvider.
    I would like the result for XMLListCollection but now I only have ArrayCollection as input. How can I deal with it? Thanks!
    <?xml version="1.0" encoding="utf-8"?> 
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
              <mx:Script> 
                        <![CDATA[ 
                                  import mx.collections.ArrayCollection; 
                                  [Bindable] 
                                  private var dp:ArrayCollection = new ArrayCollection([ 
                                            {name: "00:00:00", v1: "2"},
                                            {name: "00:15:00", v1: "3"},
                                            {name: "00:30:00", v1: "4"},
                                            {name: "00:45:00", v1: "3"},
                                            {name: "01:00:00", v1: "5"},
                                            {name: "01:15:00"},
                                            {name: "01:30:00"},
                                            {name: "01:45:00"},
                                            {name: "02:00:00"}
                        ]]>
              </mx:Script> 
              <mx:XMLListCollection id="dp2">
                        <mx:source>
                                  <mx:XMLList>
                                            <hour name="00:00:00" v1="2"/>
                                            <hour name="00:15:00" v1="3"/>
                                            <hour name="00:30:00" v1="4"/>
                                            <hour name="00:45:00" v1="3"/>
                                            <hour name="01:00:00" v1="5"/>
                                            <hour name="01:15:00" />
                                            <hour name="01:30:00" />
                                            <hour name="01:45:00" />
                                            <hour name="02:00:00" />
                                  </mx:XMLList>
                        </mx:source>
              </mx:XMLListCollection>
              <mx:LineChart id="lineChart" height="100%" width="100%" dataProvider="{dp}" showDataTips="true"> 
                        <mx:horizontalAxis> 
                                  <mx:CategoryAxis categoryField="name"/> 
                        </mx:horizontalAxis> 
                        <mx:series> 
                                  <mx:LineSeries yField="v1" form="curve" displayName="v1"/>
                        </mx:series> 
              </mx:LineChart> 
              <mx:Legend dataProvider="{lineChart}" direction="horizontal"/>
              <mx:LineChart id="lineChart2" height="100%" width="100%" dataProvider="{dp2}" showDataTips="true"> 
                        <mx:horizontalAxis> 
                                  <mx:CategoryAxis categoryField="@name"/> 
                        </mx:horizontalAxis> 
                        <mx:series> 
                                  <mx:LineSeries yField="@v1" form="curve" displayName="v1"/>
                        </mx:series> 
              </mx:LineChart> 
              <mx:Legend dataProvider="{lineChart2}" direction="horizontal"/>
    </mx:Application>

    Define a default value to v1 for each of your objects in the ArrayCollection, or even better, use a strongly typed model class. In XML this would resolve to null (or maybe an empty string?), but an object will throw a "property not found" error, which may have unexpected results (as seen above).

  • Sorting XMLListCollection by nested elements

    I've been sorting XML files using an XMLListCollection when I have an XML with the following structure:
    <products>
         <product id="1">
              <field1>value</field1>
              <field2>value</field2>
              <field3>value</field3>
         </product>
         <product id="2">
              <field1>value</field1>
              <field2>value</field2>
              <field3>value</field3>
         </product>
    </products>
    by using an XMLListCollection as follows:
    var mySort:sort = new Sort();
    var xlcProducts:XMLListCollection = new XMLListCollection();
    mySort.fields = [new SortField("field3"), new SortField("field2")]
    xlcProducts.source = dataSet.elements("product");
    xlcProducts.sort = mySort;
    xlcProducts.refresh();
    Now I'm dealing with a more complicated XML that follows this structure:
    <products>
         <product>
              <productID>607</productID>
              <productName>ADS1000</productName>
              <features>
                   <featureData>
                        <featureName>feature1</featureName>
                        <featureValue>value1</featureValue>
                   </featureData>
                   <featureData>
                        <featureName>feature2</featureName>
                        <featureValue>value2</featureValue>
                   </featureData>
                   <featureData>
                        <featureName>feature3</featureName>
                        <featureValue>value3</featureValue>
                   </featureData>
              </features>
         </product>
         <product>
              <productID>607</productID>
              <productName>ADS1000</productName>
              <features>
                   <featureData>
                        <featureName>feature1</featureName>
                        <featureValue>value1</featureValue>
                   </featureData>
                   <featureData>
                        <featureName>feature2</featureName>
                        <featureValue>value2</featureValue>
                   </featureData>
                   <featureData>
                        <featureName>feature3</featureName>
                        <featureValue>value3</featureValue>
                   </featureData>
              </features>
         </product>
    </products>
    My problem here is that the same approach doesn't seem to work, when I create the mySort object to assign to the XMLListCollection I can't seen to be able to point it to a field that is not on the top level of the XML's children. Here, I need to sort the XML by featureValue for two different features (which will change at different points in time)
    I've tried to do stuff like this to no avail:
    mySort.fields = [new SortField("features.featureData.(featureName == \"feature3\").featureValue"), new SortField("features.featureData.(featureName == \"feature2\").featureValue")]
    I'm assuming I can't have XML queries in the SortField's name, but nothing else I've tried has worked.

    Yeah, I actually started working on that approach earlier today.
    Thanks for the confirmation.

  • AdvancedDataGrid with XMLListCollection Syntax

    Hello All,
    I'm more of an XSLT/XPath guy, and need help with the syntax
    for Flex(if that's the only thing I'm doing wrong!). I have an
    XMLListCollection named "mapData" with records from a web service.
    Each record looks like this:
    <java:Results xmlns:java="java:com.example.com">
    <java:AssociatedFileID>9999</java:AssociatedFileID>
    <java:AssociatedFileName>example.csv</java:AssociatedFileName>
    <java:DataBucketID>123</java:DataBucketID>
    <java:DataBucketName>EDashboard</java:DataBucketName>
    <java:Fields>
    <java:DataBucketFieldName>Business</java:DataBucketFieldName>
    <java:DataBucketFieldValue>Loans</java:DataBucketFieldValue>
    <java:DataBucketFieldID>4281</java:DataBucketFieldID>
    </java:Fields>
    <java:Fields>
    <java:DataBucketFieldName>Section</java:DataBucketFieldName>
    <java:DataBucketFieldValue>Europe</java:DataBucketFieldValue>
    <java:DataBucketFieldID>4394</java:DataBucketFieldID>
    </java:Fields>
    <java:LoadedDateTime>2008-03-19T10:57:21-04:00</java:LoadedDateTime>
    <java:Suppressed>No</java:Suppressed>
    <java:DataBucketContentID>170</java:DataBucketContentID>
    <java:Status>Active</java:Status>
    </java:Results>
    My AdvancedDataGrid is:
    <mx:AdvancedDataGrid x="10" y="10" id="MapDG"
    designViewDataType="flat" width="100%" height="100%"
    dataProvider="{mapData}" click="{editBtn.enabled=true;}"
    selectionMode="singleRow" change="{editBtn.enabled=true;}">
    <mx:columns>
    <mx:AdvancedDataGridColumn headerText="ID"
    dataField=""/>
    <mx:AdvancedDataGridColumn headerText="Business"
    dataField=""/>
    <mx:AdvancedDataGridColumn headerText="Section"
    dataField=""/>
    </mx:columns>
    </mx:AdvancedDataGrid>
    Here's what I'm trying to do for each column:
    1 - *::Results.*::DataBucketContentID.text()
    //this is the record ID
    2. -
    *Results.*::Fields.(*::DataBucketFieldName.text()='Business').*DataBucketFieldValue.text( )
    //Gets the 'DataBucketFieldValue' for each 'Fields' that has
    a 'DataBucketFieldName' = Business
    3. -
    *Results.*::Fields.(*::DataBucketFieldName.text()='Section').*DataBucketFieldValue.text()
    //Gets the 'DataBucketFieldValue' for each 'Fields' that has
    a 'DataBucketFieldName' = Section
    What do I need to put in the columns' dataField for this to
    work?
    Thanks,
    Trav

    Thanks to Tracy and a little research, I have my data grid
    populating - I wanted to post an example that worked for me:
    If below is a variable with your web service result...
    private var personXML:XML=<persons>
    <person>
    <FirstName>Santa</FirstName>
    <Surname>Claus</Surname>
    <Age>1000</Age>
    </person>
    <person>
    <FirstName>Tooth</FirstName>
    <Surname>Fairy</Surname>
    <Age>250</Age>
    </person>
    <person>
    <FirstName>Travis</FirstName>
    <Surname>Allen</Surname>
    <Age>27</Age>
    </person>
    </persons>
    You can use a function, which you'll need to assign to a
    column. Here it is concating text in 2 elements but you can also
    use it for namespaced elements (e.g.
    item.*::NodeName1.*::NodeName2.text()).
    private function showFullName(item:Object,
    Column:DataGridColumn):String{
    var fullName:String = item.FirstName + " " + item.Surname;
    return fullName;
    The first column uses the function to populate the data in
    the column. It has to use labelFunction (vs. dataField). The 2nd
    uses the node name directly.
    <mx:DataGrid id="personDG"
    dataprovider="{personXML.person}">
    <mx:columns>
    <mx:DataGridColumn width="150" headerText="Full Name"
    labelFunction="showFullName"/>
    <mx:DataGridColumn width="150" dataField="Age"
    width="50"/>
    <!--the column without header text wil take the value of
    the element-->
    </mx:columns>
    </mx:DataGrid>
    Hope this helps anyone else!
    Trav

  • Recursively sorting child nodes in an XMLListCollection

    Does anyone know how to recursively sort an XMLListCollection.
    I know there is a bug open (http://bugs.adobe.com/jira/browse/SDK-9452) about this, but is there any workarounds?
    I really need to sort at least the first 2 levels.
    Thanks,
    -J

    Hi,
    Please check the navigation settings of the site collection.  It may be set to 50 as shown in the below screenshot.  This might be limiting to your query, change it and verify.
    Please mark it answered, if your problem resolved.

  • Grouping items from parts of an XMLListCollection?

    I have made grouping collections before.  This is an odd case, though.
    I have an XMLListCollection called menuListCollection. Each member is something like this
    <?xml version="1.0" encoding="utf-8"?>
    <recipe course="starters">
    <title>Bacon-Wrapped Ginger Soy Scallops</title>
    <recipeLink>http://www.finecooking.com/recipes/bacon-wrapped-ginger-soy-scallops.aspx </recipeLink>
    <ingredients>
    <item qty=".25" units="cup" caption="soy sauce" desc="soy sauce" section="Other Groceries" />
    <item qty="1" units="Tbs." caption="dark brown sugar" desc="dark brown sugar" section="Pantry Staples" />
    </ingredients>
    <schedule>
    <time label="1h"><instructions><![CDATA[none]]></instructions></time>
    <time label="45m"><instructions><![CDATA[Heat oven to 450°F for the Bacon-Wrapped Scallops.]]></instructions></time>
    <time label="30m"><instructions><![CDATA[Bake the Bacon-Wrapped Scallops and serve to guests to nibble while you make the final dinner preparations.]]></instructions></time>
    </schedule>
    </recipe>
    I need to work with these 3 bits: Title, RecipeLink, and Time -- grouped by label.  My goal is to easily have a listing of the instructions for all recipes grouped by time labels; that is, all the one hour instructions, all the 45 minute instructions, etc.
    Such as:
    1 Hour Before Dinner
      - instruction for recipe 1 that has this label
      - instruction for recipe 2 that has this label
    for each (var x:XML in menuListCollection){
    trace("title="+x.title);
    trace("link="+x.recipeLink);
    trace("30 minutes="+x..time.(@label=="30m").instructions.text());
    gives me
    title=Bacon-Wrapped Ginger Soy Scallops
    link=http://www.finecooking.com/recipes/bacon-wrapped-ginger-soy-scallops.aspx
    30 minutes=Bake the Bacon-Wrapped Scallops and serve to guests to nibble while you make the final dinner preparations.
    title=Beet Salad with Oregano, Pecans, and Goat Cheese
    link=http://www.finecooking.com/recipes/beet-salad-oregano-pecans-goat-cheese.aspx
    30 minutes=Finish assembling the Beet Salad.
    Is there an easy way to do this, or do I have to loop each item and make separate arrays?  I'd rather be able to use a grouping collection somehow.

    ...i would use a XMLListCollection filterFunction for that...
    that generates a special view of your collection
    r.F.

  • Arraycollection to xmllistcollection

    Is there an easy way to convert an ArrayCollection to an
    XMLListCollection? I have found plenty of references to convert the
    reverse, but none that go into an XMLListCollection or XMLList.
    I am receiving a query from a database via a RemoteObject and
    putting it directly into an ArrayCollection. Some of this data
    needs to be displayed in a Tree and I've found XMListCollection
    works better as a data provider. I wrote a method to go through the
    array and create nodes then add them to the XML, but it seems there
    would be a way to do this automatically instead. Thanks!

    You cannot cast unless the cariable you are casting contains
    an object of the type you are casting to.
    ArrayCollection will never contain an XMLListcollection, so
    forget casting.
    If the CFC IS returning xml, then set the resultFormat="e4x",
    then in the handler, do:
    var xmlResult:XML = XML(event.result);
    trace(xmlResult.toXMLString())
    Tracy

  • Editable Datagrid from programmaticaly built XmlListCollection help needed

    Hi, I am trying to build an editable datagrid with 20 empty
    rows in it. Users will fill out the cells, this then gets persisted
    to a DB, then later by making selections in a combobox, they can
    bring this data back for viewing and/or modification. I have been
    trying to create the XML dynamically and then addItem on the
    XmlListCollection to no avail. Can someone please point out where I
    am going wrong? Thanks!
    [Bindable] private var teamGridDataAsXml:XML;
    [Bindable] private var teamGridData:XMLListCollection;
    private function initEmptyTeamGrid():void {
    teamGridData = new XMLListCollection();
    var s:String = "<rows>";
    for(var i:int = 0; i < 20; i++) {
    s += "<row rowIndex=\'" + i + "\' agentId='' firstName=''
    lastName='' country='' />";
    s += "</rows>";
    teamGridDataAsXml = new XML(s);
    teamGridData.addItem(teamGridDataAsXml);
    <mx:DataGrid id="agentInfo" editable="true"
    dataProvider="{teamGridData}" width="100%" height="100%"
    rowCount="20">
    <mx:columns>
    <mx:DataGridColumn headerText="#" dataField="@rowIndex"
    editable="false"/>
    <mx:DataGridColumn headerText="Agent ID"
    dataField="@agentId" editable="true"/>
    <mx:DataGridColumn headerText="First Name"
    dataField="@firstName" editable="true"/>
    <mx:DataGridColumn headerText="Last Name"
    dataField="@lastName" editable="true"/>
    <mx:DataGridColumn headerText="Country"
    dataField="@country" editable="true"/>
    </mx:columns>
    </mx:DataGrid>

    teamGridDataAsXml = new XML(s);
    trace(teamGridDataAsXml.toXMLString() ); to be sure you have
    good xml
    var xlRows:XMLList = teamGridDataAsXml.row;
    trace(xlRows.length()); //what you expect?
    teamGridData =new XMLListCOllection(xlRows);
    You could skip the xml variable and go straignt into the
    XMLListCollection also. In the loop, build the XML node, using XML
    literal syntax, and then call addItem *inside the loop*.
    Tracy

  • Problem with xmllistcollection

    Hi
         I am new in Flex programming world. I am facing the problem with xmllistcollection which is bind to datagrid. Please help me
         I have created the custom componet. In this custom datagrid component a column having combobox. the problem aries when there
    are two duplicate rows and if i change the value of one row's combobox value then another duplicate row's combobox value is autometically
    changed.
    as i have attached the images.image 1 shows initial stage and image2 shows when i changed 5 row's combobox value then 8th rows combobox
    value is autometically changed.
    this is the code for change of combox value. commented code shows what i have tried right now
    public function DropDownEvent(evt:ListEvent):void
                 var xmlvalues:XMLListCollection= DataGrid(_listData.owner).dataProvider as XMLListCollection;
                 //var xmlListval:XMLList= xmlvalues.source as XMLList;            
                 //    XMLNotifier.getInstance().unwatchXML(xmlListval,);
                 xmlvalues[_listData.rowIndex][_listData.dataField]=evt.target.selectedItem;
             //     var xml:XML=xmlvalues.getItemAt(_listData.rowIndex) as XML;
             //    var strval:String=xml.toString();
             //    var lval:int= strval.indexOf(_listData.dataField);
             //    var lvalLength:int=_listData.dataField.length+lval+1;
            //     var str1:String=strval.substr(0,lvalLength);
              //   var lval2:int=strval.indexOf("</",lvalLength);
              //   str1=str1+evt.target.selectedItem+" "+strval.substr(lval2);
              //  var xmlNew:XML=new XML(str1);
             //    xmlvalues.removeItemAt(_listData.rowIndex);
              //   xmlvalues.addItemAt(xmlNew,_listData.rowIndex);
                 //Alert.show(xmlvalues[_listData.rowIndex].toString());
               // evt.target.data[_listData.dataField]=evt.target.selectedItem;

    the problem seems to be due to watchxml notification function, which every time call when i try to change in the xmllistcollection. there may be the solution unwatchxml. but how to use unwatchxml in my code and what will be the notification function to remove ?
    please help !

  • Adding Item into XMLListCollection

    Hi
    I store my data into a XMLListCollection variable (name XC).
    The initial lengt of this XMLListCollection is 10 items (for
    example: XC.length==10). I leave the user to filter this data and I
    added a filterfunction to this variable. I set another function
    named sync() that run every 10 seconds (for example). This function
    is trying to insert an element into XC:XMLListCollection at a
    specific position (for example 8 XC.additemat(item,8)). After the
    user filter the data, the length is 2 and when the sync() function
    is activated, this function call "addItemAt(item,8)" and I receive
    "Index out of Bound...".
    I know how to read the entire list (XMLList) using the
    .source properties but I don't know how to insert an element at a
    specific position (for example 8).
    Please help me (if you know)
    Thanks in advance
    Cristy

    I want to store this variable on the local disk into a
    SharedObject. So, if I stored the entire collection (with 10
    items), and the server send to the user another item I want to
    insert this item into the collection even the item received from
    the server is not visible by the user (because of filtefunction).
    When the user want to save the data I want to use
    sharedobject.flush() and I expect to save the entire collection (11
    items). When the user enter again in this form I want to show 11
    items and the user can filter this items in multuple ways. Thanks
    for your replay.
    Cristy

  • AS3: Dynamic XMLListCollection

    Hi,
    I am writing AIR app emulating Excel 2007.
    Trying to initialize a DataGrid dataProvider, which is XMLListCollection.
    Need to create something like that:
    <root>
    <row><A/><B/><C/>...</row>
    </root>
    But the number of rows and columns should be paramatrized like:
    private function initDG(colNum:int, rowNum:int):void {
    if (!gridData)
         gridData = new XMLListCollection();
    for (var j:int=0; j < rowNum; j++) {                   
        for (var i:int=0; i < colNum; i++) {                  
              // WHAT should be here to initialize every element of XMLListCollection ???         
             //gridData.addItem({<row><A/><B/><C/><D/><E/></row>}); // that obviously doesn't work  
    grid.dataProvider = dataGrid;
    this.addChild(grid);         
    TIA,
    Oleg.

    To answer my question the initialization loop should be something like that:
    for (var j:int=0; j < rowNum; j++) {
          rowXML = <row/>;
          for (var i:int=0; i < colNum; i++) {    // init each DG cell to "" (i.e. like: <A/>)                      
              rowXML.appendChild(new XML("<"+colNames[i]+"/>"));
         gridData.addItem(rowXML);
    Thanks,
    Oleg.

  • Why can't I access this in an XMLListCollection?

    I am updating an older application to better use what I have learned in the interim.  I am using the same approach to loading XML and populating a viewstack based on the number of items in the XML file as I have been doing lately successfully.  However, for reasons I do not understand, this time it is not letting me access a value.
    [Bindable]
          private var dataXML:XMLListCollection = new XMLListCollection();
    private function dataHandler(event:ResultEvent):void {
            var list:XMLList = new XMLList(event.result..step);
           dataXML = new XMLListCollection(list);
            createSteps();
    private function createSteps():void{
            for each(var step:XML in dataXML){
            var stepNumber:uint = 1;
            var recipeStep:CyorStep = new CyorStep();
            mainViewStack.addChild(recipeStep);
            trace(dataXML.title);
    I get an error: 1119: Access of possibly undefined property title through a reference with static type mx.collections:XMLListCollection
    Why?
    The XML is like:
    <steps>
    <step>
    <title>Meat, Poultry or Fish</title>
    <ingredientList">
    <items>
    </items>
    </ingredientList>
    <bodyText>....</bodyText>
    </step>
    <step>
    <title>Meat, Poultry or Fish</title>
    <ingredientList">
    <items>
    </items>
    </ingredientList>
    <bodyText>....</bodyText>
    </step>
    etc...
    </steps>

    I am an idiot.
    private function createSteps():void{
            for each(var step:XML in dataXML){
            var stepNumber:uint = 1;
            var recipeStep:CyorStep = new CyorStep();
            mainViewStack.addChild(recipeStep);
            trace(dataXML.title);
    it should be
    private function createSteps():void{
            for each(var step:XML in dataXML){
            var stepNumber:uint = 1;
            var recipeStep:CyorStep = new CyorStep();
            mainViewStack.addChild(recipeStep);
            trace(step.title);
    whoops!
    Thanks for your help anyway.

  • Help with xmlListCollection and getItemAt method!

    All,
      I have a simple application in which I have a data grid, http sevice and xmllistcollection. I get the xml data and populate the xmllistcollection. Objective is to traverse the xmlcollection to get the first row, parse and set the column headers dynamically.
    the first row in the xmllistcollection are the column headers. I am trying to get the values using the getItemAt(0) method, which does return a object but not sure how to traverse the object to draw the column headers for the data grid dynamically? below is the sample example
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
      <![CDATA[
       import mx.collections.ArrayCollection;
       import mx.rpc.events.ResultEvent;
       import mx.rpc.events.FaultEvent;
       import mx.controls.Alert;
       import mx.controls.dataGridClasses.DataGridColumn;
              public function fetch():void
          xmlRPC.send();        
          var i:int = 0;     
          var a:XMLList = new XMLList(xdata.getItemAt(0).toString() as XMLList); 
         Alert.show(a.text() + "a");
         for each(var xml:XML in a)
           Alert.show("I am inside" + i);
           var attributes:XMLList = xml.attributes();
           var o:Object = new Object();
           for each (var attribute:XML in attributes)
            Alert.show("I am  way inside" + i);
            var nodeName:String = attribute.name().toString();
            var value:*;
            Alert.show(attribute.toString());
            value = attribute.toString();
               i = i+1;   
      ]]>
    </mx:Script>
        <mx:HTTPService result="handleXMLnew(event);" fault="handleFault(event);" id="xmlRPC" resultFormat="e4x"
        url="http://abc/Xcelsius/swat/RCD.xsql" useProxy="false">
    </mx:HTTPService>
    <mx:XMLListCollection id="xdata" source="{xmlRPC.lastResult.ROW}"/>
    <mx:DataGrid dataProvider="{xdata}" x="24" y="110" id="adg1" width="694" height="168"/>
    <mx:Button x="653" y="44" label="Go" click="fetch();"/>
    </mx:Application>

    try this, to  parse and set the column headers dynamically.
    http://flexpearls.blogspot.com/2008/02/generating-dg-columns-for-xml-data.html
    Hope this will work.

Maybe you are looking for

  • Web Dynpros -- possible to call a SAPGUI operation?

    We're developing an Web Dynpro application in which it would be appropriate to invoke a "SAPGUI" operation, such as a TCode (ex., SE09), a call dialog, or a function module which displays a useful pop-up. Is this possible from a Web Dynpro? Our attem

  • RMAN Database Recovery

    Dear All I am using oracle 10.0.2.4 on linux 5. I have take backup from RMAN by using backup database. Now i shutdown database and rename the system,sysaux,undo,users datafies. Than start db in force mount mode by using startup force mount Than i res

  • Video playback very slow/failing with both iGPU and dGPU enabled simultaneously

    Until a couple of months ago, my PC was running with an i5 760 and my current Radeon HD 7850 on Premiere Elements 11 just fine - playback was smooth and I could edit my videos just fine. However, recently I installed a new CPU and motherboard - an i7

  • Changing CSV Defualt Volume# to Another

    I'm am currently running a 2 host test cluster connected to  Dell Compellent using SMI-S. After I created a new logical unit as a shared volume, it default calls the new CSV Volume1 but I am not finding anywhere during the creation phase to change th

  • My SA-CT60 sound bar will not power up.

    New remote batteries, good power source.  The indicator lights will very faintly flicker when I hit the power button on the remote.  This will only happen when I reset the remote with the three button code.  Hit power, flicker, dead soundbar.  Is the