ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

View: New views
13 Messages — Rating Filter:   Alert me  

ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi FlexCoders,

I have an array collection which I am populating as follows:

var oTemp:Object;
var xl:XMLList = _xmlData.children();
var i:int;
for(i = 0; i < xl.length(); i++) 
{
 oTemp = {ID_TAG:xl[i].ID.text(), CAT_TAG:xl[i].CAT.text(), DET_TAG:xl[i].DET.text(), REP_DATE_TAG:xl[i].REP_DATE.text(), IND_TAG:xl[i].IND.text()};
 arrDP.addItem(oTemp);
}

Now, when I pass back this Array Collection back into a web service, the fields are not in order as I have added them into the array collection.

I am expecting that in my Web Service, when I parse this arraycollection (via arraylist), I would be getting the same order of columns as I have added them, i.e. the first array in the array list would have element 0 to be the value I placed in the ID.

Since the arraylist does not have the field tag (represented by ID_TAG, DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on my part since I can only reference the value via the index on the array.

Now, how would I be able to include the tags inside array collection such that when I read them as an array list in my .NET webservice, I know which element I am referring to in a particular index.

Thanks.

Regards,
Angelo


     

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Sam Lai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How is it being parsed in .NET? You can parse it into a hashtable, or
better yet, use a pre-defined object.

Not sure why the order is different, but it is probably fragile to
rely on the order in this case.

2009/7/2 Angelo Anolin <angelo_anolin@...>:

>
>
> Hi FlexCoders,
>
> I have an array collection which I am populating as follows:
>
> var oTemp:Object;
> var xl:XMLList = _xmlData.children();
> var i:int;
> for(i = 0; i < xl.length(); i++)
> {
>  oTemp = {ID_TAG:xl[i].ID.text(), CAT_TAG:xl[i].CAT.text(),
> DET_TAG:xl[i].DET.text(), REP_DATE_TAG:xl[i].REP_DATE.text(),
> IND_TAG:xl[i].IND.text()};
>  arrDP.addItem(oTemp);
> }
> Now, when I pass back this Array Collection back into a web service, the
> fields are not in order as I have added them into the array collection.
>
> I am expecting that in my Web Service, when I parse this arraycollection
> (via arraylist), I would be getting the same order of columns as I have
> added them, i.e. the first array in the array list would have element 0 to
> be the value I placed in the ID.
>
> Since the arraylist does not have the field tag (represented by ID_TAG,
> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on my
> part since I can only reference the value via the index on the array.
>
> Now, how would I be able to include the tags inside array collection such
> that when I read them as an array list in my .NET webservice, I know which
> element I am referring to in a particular index.
>
> Thanks.
>
> Regards,
> Angelo
>
>
>

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sam,

Care to show some examples? I am parsing the arrayCollection into an ArrayList on .NET.  This is particularly not too appealing since I just discovered that for example, if one of the objects in the arraycollection would have an empty string value, the number of items inside the array is not reflected properly in .NET.

Like:

private var arrR:ArrayCollection = new ArrayCollection([{ID:"001", Value:"Select"},
                                                        {ID:"002", Value:"Choose"},
                                                        {ID:"003", Value:""},]);

When I pass this var arrR into a .NET webservice and delegate it to an ArrayList, the items in the array list will have one of the arrays only containing 1 item (instead of 2).

Adding to my problem is the fact that the arrays inside the array list when read in .NET should have the object ID and Value be in order but they are not.  This is further true when there are many items in the array collection.  Sometimes, the first item becomes the last one in the array list, and sometimes the order is not well.

In any case, I am finding a solution on how I would be able to pass an ArrayCollection to .NET and be able to parse it properly.

Thanks.




________________________________
From: Sam Lai <samuel.lai@...>
To: flexcoders@...
Sent: Thursday, 2 July, 2009 15:46:58
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService





How is it being parsed in .NET? You can parse it into a hashtable, or
better yet, use a pre-defined object.

Not sure why the order is different, but it is probably fragile to
rely on the order in this case.

2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:

>
>
> Hi FlexCoders,
>
> I have an array collection which I am populating as follows:
>
> var oTemp:Object;
> var xl:XMLList = _xmlData.children( );
> var i:int;
> for(i = 0; i < xl.length(); i++)
> {
>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
> IND_TAG:xl[i] .IND.text( )};
>  arrDP.addItem( oTemp);
> }
> Now, when I pass back this Array Collection back into a web service, the
> fields are not in order as I have added them into the array collection.
>
> I am expecting that in my Web Service, when I parse this arraycollection
> (via arraylist), I would be getting the same order of columns as I have
> added them, i.e. the first array in the array list would have element 0 to
> be the value I placed in the ID.
>
> Since the arraylist does not have the field tag (represented by ID_TAG,
> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on my
> part since I can only reference the value via the index on the array.
>
> Now, how would I be able to include the tags inside array collection such
> that when I read them as an array list in my .NET webservice, I know which
> element I am referring to in a particular index.
>
> Thanks.
>
> Regards,
> Angelo
>
>
>




     

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Sam Lai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_anolin@...>:

>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollection = new ArrayCollection([{ID:"001",
> Value:"Select"},
>                                                         {ID:"002",
> Value:"Choose"},
>                                                         {ID:"003",
> Value:""},]);
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list when
> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ________________________________
> From: Sam Lai <samuel.lai@...>
> To: flexcoders@...
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0 to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know which
>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
>

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sam,
Basically this is the process which I am using.

.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return the dataset as XML string via the command DataSet.GetXML.

Flex
In the event handler of my webservice method call, I parse the string into XML, then ArrayCollection via the following codes:

private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollection = new ArrayCollection;
_xmlData = XML(event.result);
var oTemp:Object;
var xl:XMLList = _xmlData.children();
var i:int;
for(i = 0; i < xl.length(); i++) 
{
 oTemp = {NAME:xl[i].NAME.text(), TEAM:xl[i].TEAM.text(),
    JERSEY:xl[i].JERSEY.text(), MANAGER:xl[i].MANAGER.text()};
 arrDP.addItem(oTemp);
}

and in my datagrid, I am setting its dataProvider to the arrDP variable.

I used Array Collection because I implemented a search and filter functionality which searches and filters the data accordingly for the dataprovider which is then reflected back to the datagrid.
Now, when I need to return the ArrayCollection to .NET, I simply pass the same as a parameter to a .NET function which accepts ArrayList as parameter.

.NET
Once the function receieves the arraycollection (which is then now an array list), I get the arrays inside the arraylist and get the values inside the array. 

I think by doing things like this, it may not be the best way.

You mentioned you'd map the XML to typed objects in .NET.  How can I do this?

Instead of using arraycollection as dataprovider in my datagrid, can I use another which would be much easier when I pass back to the .NET function?

Whats the best way to interact large set of data (datasets) between .NET and Flex?

Thanks a lot.

 



________________________________
From: Sam Lai <samuel.lai@...>
To: flexcoders@...
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService





Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:

>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> Value:"Select" },
>                                                         {ID:"002",
> Value:"Choose" },
>                                                         {ID:"003",
> Value:""},]) ;
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list when
> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@gmail. com>
> To: flexcoders@yahoogro ups.com
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0 to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know which
>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
>




     

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Sam Lai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just wrote up a simple C# web service that accepts an ArrayList:

[WebMethod]
public bool ArrayListTest(System.Collections.ArrayList a)
{ ... }

Then in Flex I wrote this,

<mx:Script>
<![CDATA[
                        import mx.collections.ArrayCollection;
                        private function sendWebServiceCall():void
                        {
                                trace("appComplete");
                                ws.ArrayListTest(new ArrayCollection([ {name:"bob", id:"808" }, {
name:"fred", id:"" }]));
                        }
]]>
</mx:Script>
<mx:WebService wsdl="http://localhost:63868/Service1.asmx?WSDL" id="ws">
        <mx:operation name="ArrayListTest" result="trace(event.result)"
         fault="trace(event.fault.faultString)"/>
</mx:WebService>

When sendWebServiceCall is triggered, it calls the C# web service and
passes the ArrayCollection to it.

In the web service, the ArrayCollection is received as an array list
of XmlNodes. Each XmlNode contains a node for each field, even if it
is an empty string.

<tns:id xmlns:tns="http://tempuri.org/">808</tns:id>
<tns:name xmlns:tns="http://tempuri.org/">bob</tns:name>

<tns:id xmlns:tns="http://tempuri.org/"></tns:id>
<tns:name xmlns:tns="http://tempuri.org/">fred</tns:name>

Is this anything like what you're getting? The edge case you described
in another email about an empty string causing problems doesn't seem
to cause problems.

Also see inline.

2009/7/3 Angelo Anolin <angelo_anolin@...>:
> I think by doing things like this, it may not be the best way.
>
> You mentioned you'd map the XML to typed objects in .NET.  How can I do
> this?

As you're using a dataset, this isn't really an option. A dataset as
opposed to a collection of typed objects are two ways of handling data
from data sources; it is arguable which way is better.

The problem in your case, is that the XML generated as a result of
passing an ArrayCollection to a web service method cannot be passed
into the dataset's readXml method. (Even if it could by inferring a
schema, it would be different to your database's schema.)

The only way I know of to do seamless transfer of data without having
to parse XML is to use WebORB. Otherwise you will have to parse the
XML produced on both sides to re-create the dataset/object.

> Instead of using arraycollection as dataprovider in my datagrid, can I use
> another which would be much easier when I pass back to the .NET function?

I wonder if it is possible to bind your datagrid directly to the e4x
XML? That way you can pass the entire XML doc back to .NET via the web
service, and hence you can re-create the dataset using
dataset.readXML.

> ________________________________
> From: Sam Lai <samuel.lai@...>
> To: flexcoders@...
> Sent: Friday, 3 July, 2009 13:52:12
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> Instead of using an array list and trying to emulate the type-less
> abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
> does the XML from your Flex app differ too wildly to do this?
>
> Are you using the XmlSerializer to deserialize this? Or are you using
> WCF? Or are you doing it some other way, or manually?
>
> I'd provide an example, but I don't know enough details on your
> situation to give something useful :)
>
> 2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi Sam,
>>
>> Care to show some examples? I am parsing the arrayCollection into an
>> ArrayList on .NET.  This is particularly not too appealing since I just
>> discovered that for example, if one of the objects in the arraycollection
>> would have an empty string value, the number of items inside the array is
>> not reflected properly in .NET.
>>
>> Like:
>>
>> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
>> Value:"Select" },
>>                                                         {ID:"002",
>> Value:"Choose" },
>>                                                         {ID:"003",
>> Value:""},]) ;
>>
>> When I pass this var arrR into a .NET webservice and delegate it to an
>> ArrayList, the items in the array list will have one of the arrays only
>> containing 1 item (instead of 2).
>>
>> Adding to my problem is the fact that the arrays inside the array list
>> when
>> read in .NET should have the object ID and Value be in order but they are
>> not.  This is further true when there are many items in the array
>> collection.  Sometimes, the first item becomes the last one in the array
>> list, and sometimes the order is not well.
>>
>> In any case, I am finding a solution on how I would be able to pass an
>> ArrayCollection to .NET and be able to parse it properly.
>>
>> Thanks.
>>
>> ____________ _________ _________ __
>> From: Sam Lai <samuel.lai@gmail. com>
>> To: flexcoders@yahoogro ups.com
>> Sent: Thursday, 2 July, 2009 15:46:58
>> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
>> When
>> Passed to .NET WebService
>>
>> How is it being parsed in .NET? You can parse it into a hashtable, or
>> better yet, use a pre-defined object.
>>
>> Not sure why the order is different, but it is probably fragile to
>> rely on the order in this case.
>>
>> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>>
>>>
>>> Hi FlexCoders,
>>>
>>> I have an array collection which I am populating as follows:
>>>
>>> var oTemp:Object;
>>> var xl:XMLList = _xmlData.children( );
>>> var i:int;
>>> for(i = 0; i < xl.length(); i++)
>>> {
>>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>>> IND_TAG:xl[i] .IND.text( )};
>>>  arrDP.addItem( oTemp);
>>> }
>>> Now, when I pass back this Array Collection back into a web service, the
>>> fields are not in order as I have added them into the array collection.
>>>
>>> I am expecting that in my Web Service, when I parse this arraycollection
>>> (via arraylist), I would be getting the same order of columns as I have
>>> added them, i.e. the first array in the array list would have element 0
>>> to
>>> be the value I placed in the ID.
>>>
>>> Since the arraylist does not have the field tag (represented by ID_TAG,
>>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>>> my
>>> part since I can only reference the value via the index on the array.
>>>
>>> Now, how would I be able to include the tags inside array collection such
>>> that when I read them as an array list in my .NET webservice, I know
>>> which
>>> element I am referring to in a particular index.
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Angelo
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
>

RE: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Tracy Spratt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why not use XMLListCollection and send the xml to .net as a string?  There
is little value in building an ArrayCollection of generic obects.  You can
sort/filter an XMLListCollection.

 

XML is more verbose than some other methods, but if bandwidth is truly an
issue, then you should be looking at a binary protocol.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@... [mailto:flexcoders@...] On
Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcoders@...
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

 






Hi Sam,

Basically this is the process which I am using.

 

.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return
the dataset as XML string via the command DataSet.GetXML.

 

Flex
In the event handler of my webservice method call, I parse the string into
XML, then ArrayCollection via the following codes:

 

private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollection = new ArrayCollection;

_xmlData = XML(event.result);
var oTemp:Object;
var xl:XMLList = _xmlData.children();

var i:int;
for(i = 0; i < xl.length(); i++)  
{
 oTemp = {NAME:xl[i].NAME.text(), TEAM:xl[i].TEAM.text(),
    JERSEY:xl[i].JERSEY.text(), MANAGER:xl[i].MANAGER.text()};
 arrDP.addItem(oTemp);
}

 

and in my datagrid, I am setting its dataProvider to the arrDP variable.

 

I used Array Collection because I implemented a search and filter
functionality which searches and filters the data accordingly for the
dataprovider which is then reflected back to the datagrid.

Now, when I need to return the ArrayCollection to .NET, I simply pass the
same as a parameter to a .NET function which accepts ArrayList as parameter.

 

.NET
Once the function receieves the arraycollection (which is then now an array
list), I get the arrays inside the arraylist and get the values inside the
array.

 

I think by doing things like this, it may not be the best way.

 

You mentioned you'd map the XML to typed objects in .NET.  How can I do
this?

 

Instead of using arraycollection as dataprovider in my datagrid, can I use
another which would be much easier when I pass back to the .NET function?

 

Whats the best way to interact large set of data (datasets) between .NET and
Flex?

 

Thanks a lot.


 

 

  _____  

From: Sam Lai <samuel.lai@...>
To: flexcoders@...
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_anolin@ <mailto:angelo_anolin%40yahoo.com>
yahoo.com>:

>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> Value:"Select" },
>                                                         {ID:"002",
> Value:"Choose" },
>                                                         {ID:"003",
> Value:""},]) ;
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list
when

> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@gmail. com <mailto:samuel.lai%40gmail.com> >
> To: flexcoders@yahoogro ups.com <mailto:flexcoders%40yahoogroups.com>
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
When

> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0
to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know
which

>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
>

 




Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sam Lai,

THanks for the input and my apologies for replying late since I felt the need to get deeper on the issue I am encountering.

In my web service, the arraycollection is received as an array list and yes, it is like an array of xml nodes.

In my arraycollection, say I have 5 columns and when one of the columns contains an empty string, when I pass it to my .NET webservice, the arraylist will have an array which only contains 4 columns (instead of the expected 5).  That is why the empty field is actually causing me some problems.

I am trying to find some E4x documentation / article specifically tackling this kind of .NET and Flex integration. Do you know of some?

Thanks and regards,

Angelo




________________________________
From: Sam Lai <samuel.lai@...>
To: flexcoders@...
Sent: Saturday, 4 July, 2009 12:54:53
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService





I just wrote up a simple C# web service that accepts an ArrayList:

[WebMethod]
public bool ArrayListTest( System.Collectio ns.ArrayList a)
{ ... }

Then in Flex I wrote this,

<mx:Script>
<![CDATA[
import mx.collections. ArrayCollection;
private function sendWebServiceCall( ):void
{
trace("appComplete" );
ws.ArrayListTest( new ArrayCollection( [ {name:"bob", id:"808" }, {
name:"fred", id:"" }]));
}
]]>
</mx:Script>
<mx:WebService wsdl="http://localhost: 63868/Service1. asmx?WSDL" id="ws">
<mx:operation name="ArrayListTest " result="trace( event.result) "
fault="trace( event.fault. faultString) "/>
</mx:WebService>

When sendWebServiceCall is triggered, it calls the C# web service and
passes the ArrayCollection to it.

In the web service, the ArrayCollection is received as an array list
of XmlNodes. Each XmlNode contains a node for each field, even if it
is an empty string.

<tns:id xmlns:tns="http://tempuri. org/">808</tns:id>
<tns:name xmlns:tns="http://tempuri. org/">bob</tns:name>

<tns:id xmlns:tns="http://tempuri. org/"></tns:id>
<tns:name xmlns:tns="http://tempuri. org/">fred</tns: name>

Is this anything like what you're getting? The edge case you described
in another email about an empty string causing problems doesn't seem
to cause problems.

Also see inline.

2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
> I think by doing things like this, it may not be the best way.
>
> You mentioned you'd map the XML to typed objects in .NET.  How can I do
> this?

As you're using a dataset, this isn't really an option. A dataset as
opposed to a collection of typed objects are two ways of handling data
from data sources; it is arguable which way is better.

The problem in your case, is that the XML generated as a result of
passing an ArrayCollection to a web service method cannot be passed
into the dataset's readXml method. (Even if it could by inferring a
schema, it would be different to your database's schema.)

The only way I know of to do seamless transfer of data without having
to parse XML is to use WebORB. Otherwise you will have to parse the
XML produced on both sides to re-create the dataset/object.

> Instead of using arraycollection as dataprovider in my datagrid, can I use
> another which would be much easier when I pass back to the .NET function?

I wonder if it is possible to bind your datagrid directly to the e4x
XML? That way you can pass the entire XML doc back to .NET via the web
service, and hence you can re-create the dataset using
dataset.readXML.

> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@gmail. com>
> To: flexcoders@yahoogro ups.com
> Sent: Friday, 3 July, 2009 13:52:12
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> Instead of using an array list and trying to emulate the type-less
> abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
> does the XML from your Flex app differ too wildly to do this?
>
> Are you using the XmlSerializer to deserialize this? Or are you using
> WCF? Or are you doing it some other way, or manually?
>
> I'd provide an example, but I don't know enough details on your
> situation to give something useful :)
>
> 2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi Sam,
>>
>> Care to show some examples? I am parsing the arrayCollection into an
>> ArrayList on .NET.  This is particularly not too appealing since I just
>> discovered that for example, if one of the objects in the arraycollection
>> would have an empty string value, the number of items inside the array is
>> not reflected properly in .NET.
>>
>> Like:
>>
>> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
>> Value:"Select" },
>>                                                         {ID:"002",
>> Value:"Choose" },
>>                                                         {ID:"003",
>> Value:""},]) ;
>>
>> When I pass this var arrR into a .NET webservice and delegate it to an
>> ArrayList, the items in the array list will have one of the arrays only
>> containing 1 item (instead of 2).
>>
>> Adding to my problem is the fact that the arrays inside the array list
>> when
>> read in .NET should have the object ID and Value be in order but they are
>> not.  This is further true when there are many items in the array
>> collection.  Sometimes, the first item becomes the last one in the array
>> list, and sometimes the order is not well.
>>
>> In any case, I am finding a solution on how I would be able to pass an
>> ArrayCollection to .NET and be able to parse it properly.
>>
>> Thanks.
>>
>> ____________ _________ _________ __
>> From: Sam Lai <samuel.lai@ gmail. com>
>> To: flexcoders@yahoogro ups.com
>> Sent: Thursday, 2 July, 2009 15:46:58
>> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
>> When
>> Passed to .NET WebService
>>
>> How is it being parsed in .NET? You can parse it into a hashtable, or
>> better yet, use a pre-defined object.
>>
>> Not sure why the order is different, but it is probably fragile to
>> rely on the order in this case.
>>
>> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>>
>>>
>>> Hi FlexCoders,
>>>
>>> I have an array collection which I am populating as follows:
>>>
>>> var oTemp:Object;
>>> var xl:XMLList = _xmlData.children( );
>>> var i:int;
>>> for(i = 0; i < xl.length(); i++)
>>> {
>>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>>> IND_TAG:xl[i] .IND.text( )};
>>>  arrDP.addItem( oTemp);
>>> }
>>> Now, when I pass back this Array Collection back into a web service, the
>>> fields are not in order as I have added them into the array collection.
>>>
>>> I am expecting that in my Web Service, when I parse this arraycollection
>>> (via arraylist), I would be getting the same order of columns as I have
>>> added them, i.e. the first array in the array list would have element 0
>>> to
>>> be the value I placed in the ID.
>>>
>>> Since the arraylist does not have the field tag (represented by ID_TAG,
>>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>>> my
>>> part since I can only reference the value via the index on the array.
>>>
>>> Now, how would I be able to include the tags inside array collection such
>>> that when I read them as an array list in my .NET webservice, I know
>>> which
>>> element I am referring to in a particular index.
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Angelo
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
>




     

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by A. Resa Jones (Resa) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Do you think that it would help if you converted your array collection to an array collection of typed objects before sending it  to .net?

--- In flexcoders@..., Angelo Anolin <angelo_anolin@...> wrote:

>
> Hi Sam Lai,
>
> THanks for the input and my apologies for replying late since I felt the need to get deeper on the issue I am encountering.
>
> In my web service, the arraycollection is received as an array list and yes, it is like an array of xml nodes.
>
> In my arraycollection, say I have 5 columns and when one of the columns contains an empty string, when I pass it to my .NET webservice, the arraylist will have an array which only contains 4 columns (instead of the expected 5).� That is why the empty field is actually causing me some problems.
>
> I am trying to find some E4x documentation / article specifically tackling this kind of .NET and Flex integration. Do you know of some?
>
> Thanks and regards,
>
> Angelo
>
>
>
>
> ________________________________
> From: Sam Lai <samuel.lai@...>
> To: flexcoders@...
> Sent: Saturday, 4 July, 2009 12:54:53
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
>
>
>
>
>
> I just wrote up a simple C# web service that accepts an ArrayList:
>
> [WebMethod]
> public bool ArrayListTest( System.Collectio ns.ArrayList a)
> { ... }
>
> Then in Flex I wrote this,
>
> <mx:Script>
> <![CDATA[
> import mx.collections. ArrayCollection;
> private function sendWebServiceCall( ):void
> {
> trace("appComplete" );
> ws.ArrayListTest( new ArrayCollection( [ {name:"bob", id:"808" }, {
> name:"fred", id:"" }]));
> }
> ]]>
> </mx:Script>
> <mx:WebService wsdl="http://localhost: 63868/Service1. asmx?WSDL" id="ws">
> <mx:operation name="ArrayListTest " result="trace( event.result) "
> fault="trace( event.fault. faultString) "/>
> </mx:WebService>
>
> When sendWebServiceCall is triggered, it calls the C# web service and
> passes the ArrayCollection to it.
>
> In the web service, the ArrayCollection is received as an array list
> of XmlNodes. Each XmlNode contains a node for each field, even if it
> is an empty string.
>
> <tns:id xmlns:tns="http://tempuri. org/">808</tns:id>
> <tns:name xmlns:tns="http://tempuri. org/">bob</tns:name>
>
> <tns:id xmlns:tns="http://tempuri. org/"></tns:id>
> <tns:name xmlns:tns="http://tempuri. org/">fred</tns: name>
>
> Is this anything like what you're getting? The edge case you described
> in another email about an empty string causing problems doesn't seem
> to cause problems.
>
> Also see inline.
>
> 2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
> > I think by doing things like this, it may not be the best way.
> >
> > You mentioned you'd map the XML to typed objects in .NET.� How can I do
> > this?
>
> As you're using a dataset, this isn't really an option. A dataset as
> opposed to a collection of typed objects are two ways of handling data
> from data sources; it is arguable which way is better.
>
> The problem in your case, is that the XML generated as a result of
> passing an ArrayCollection to a web service method cannot be passed
> into the dataset's readXml method. (Even if it could by inferring a
> schema, it would be different to your database's schema.)
>
> The only way I know of to do seamless transfer of data without having
> to parse XML is to use WebORB. Otherwise you will have to parse the
> XML produced on both sides to re-create the dataset/object.
>
> > Instead of using arraycollection as dataprovider in my datagrid, can I use
> > another which would be much easier when I pass back to the .NET function?
>
> I wonder if it is possible to bind your datagrid directly to the e4x
> XML? That way you can pass the entire XML doc back to .NET via the web
> service, and hence you can re-create the dataset using
> dataset.readXML.
>
> > ____________ _________ _________ __
> > From: Sam Lai <samuel.lai@gmail. com>
> > To: flexcoders@yahoogro ups.com
> > Sent: Friday, 3 July, 2009 13:52:12
> > Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> > Passed to .NET WebService
> >
> > Instead of using an array list and trying to emulate the type-less
> > abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
> > does the XML from your Flex app differ too wildly to do this?
> >
> > Are you using the XmlSerializer to deserialize this? Or are you using
> > WCF? Or are you doing it some other way, or manually?
> >
> > I'd provide an example, but I don't know enough details on your
> > situation to give something useful :)
> >
> > 2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
> >>
> >>
> >> Hi Sam,
> >>
> >> Care to show some examples? I am parsing the arrayCollection into an
> >> ArrayList on .NET.� This is particularly not too appealing since I just
> >> discovered that for example, if one of the objects in the arraycollection
> >> would have an empty string value, the number of items inside the array is
> >> not reflected properly in .NET.
> >>
> >> Like:
> >>
> >> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> >> Value:"Select" },
> >> ��������������������������������������������������������{ID:"002",
> >> Value:"Choose" },
> >> ������������������������������������������������������� {ID:"003",
> >> Value:""},]) ;
> >>
> >> When I pass this var arrR into a .NET webservice and delegate it to an
> >> ArrayList, the items in the array list will have one of the arrays only
> >> containing 1 item (instead of 2).
> >>
> >> Adding to my problem is the fact that the arrays inside the array list
> >> when
> >> read in .NET should have the object ID and Value be in order but they are
> >> not.� This is further true when there are many items in the array
> >> collection.� Sometimes, the first item becomes the last one in the array
> >> list, and sometimes the order is not well.
> >>
> >> In any case, I am finding a solution on how I would be able to pass an
> >> ArrayCollection to .NET and be able to parse it properly.
> >>
> >> Thanks.
> >>
> >> ____________ _________ _________ __
> >> From: Sam Lai <samuel.lai@ gmail. com>
> >> To: flexcoders@yahoogro ups.com
> >> Sent: Thursday, 2 July, 2009 15:46:58
> >> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
> >> When
> >> Passed to .NET WebService
> >>
> >> How is it being parsed in .NET? You can parse it into a hashtable, or
> >> better yet, use a pre-defined object.
> >>
> >> Not sure why the order is different, but it is probably fragile to
> >> rely on the order in this case.
> >>
> >> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
> >>>
> >>>
> >>> Hi FlexCoders,
> >>>
> >>> I have an array collection which I am populating as follows:
> >>>
> >>> var oTemp:Object;
> >>> var xl:XMLList = _xmlData.children( );
> >>> var i:int;
> >>> for(i = 0; i < xl.length(); i++)
> >>> {
> >>> �oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
> >>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
> >>> IND_TAG:xl[i] .IND.text( )};
> >>> �arrDP.addItem( oTemp);
> >>> }
> >>> Now, when I pass back this Array Collection back into a web service, the
> >>> fields are not in order as I have added them into the array collection.
> >>>
> >>> I am expecting that in my Web Service, when I parse this arraycollection
> >>> (via arraylist), I would be getting the same order of columns as I have
> >>> added them, i.e. the first array in the array list would have element 0
> >>> to
> >>> be the value I placed in the ID.
> >>>
> >>> Since the arraylist does not have the field tag (represented by ID_TAG,
> >>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
> >>> my
> >>> part since I can only reference the value via the index on the array.
> >>>
> >>> Now, how would I be able to include the tags inside array collection such
> >>> that when I read them as an array list in my .NET webservice, I know
> >>> which
> >>> element I am referring to in a particular index.
> >>>
> >>> Thanks.
> >>>
> >>> Regards,
> >>> Angelo
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>



Re: Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Adrian,

I would try, but I have little idea on how I would convert my array collection to an array collection of typed objects.

Care to show some sample codes?

Thanks.




________________________________
From: Adrian Resa Jones <noregrets62@...>
To: flexcoders@...
Sent: Wednesday, 8 July, 2009 2:14:13
Subject: [flexcoders] Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService






Do you think that it would help if you converted your array collection to an array collection of typed objects before sending it to .net?

--- In flexcoders@yahoogro ups.com, Angelo Anolin <angelo_anolin@ ...> wrote:

>
> Hi Sam Lai,
>
> THanks for the input and my apologies for replying late since I felt the need to get deeper on the issue I am encountering.
>
> In my web service, the arraycollection is received as an array list and yes, it is like an array of xml nodes.
>
> In my arraycollection, say I have 5 columns and when one of the columns contains an empty string, when I pass it to my .NET webservice, the arraylist will have an array which only contains 4 columns (instead of the expected 5).� That is why the empty field is actually causing me some problems.
>
> I am trying to find some E4x documentation / article specifically tackling this kind of .NET and Flex integration. Do you know of some?
>
> Thanks and regards,
>
> Angelo
>
>
>
>
> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@ ...>
> To: flexcoders@yahoogro ups.com
> Sent: Saturday, 4 July, 2009 12:54:53
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
>
>
>
>
>
> I just wrote up a simple C# web service that accepts an ArrayList:
>
> [WebMethod]
> public bool ArrayListTest( System.Collectio ns.ArrayList a)
> { ... }
>
> Then in Flex I wrote this,
>
> <mx:Script>
> <![CDATA[
> import mx.collections. ArrayCollection;
> private function sendWebServiceCall( ):void
> {
> trace("appComplete" );
> ws.ArrayListTest( new ArrayCollection( [ {name:"bob", id:"808" }, {
> name:"fred", id:"" }]));
> }
> ]]>
> </mx:Script>
> <mx:WebService wsdl="http://localhost: 63868/Service1. asmx?WSDL" id="ws">
> <mx:operation name="ArrayListTest " result="trace( event.result) "
> fault="trace( event.fault. faultString) "/>
> </mx:WebService>
>
> When sendWebServiceCall is triggered, it calls the C# web service and
> passes the ArrayCollection to it.
>
> In the web service, the ArrayCollection is received as an array list
> of XmlNodes. Each XmlNode contains a node for each field, even if it
> is an empty string.
>
> <tns:id xmlns:tns="http://tempuri. org/">808</tns: id>
> <tns:name xmlns:tns="http://tempuri. org/">bob</tns: name>
>
> <tns:id xmlns:tns="http://tempuri. org/"></tns: id>
> <tns:name xmlns:tns="http://tempuri. org/">fred</ tns: name>
>
> Is this anything like what you're getting? The edge case you described
> in another email about an empty string causing problems doesn't seem
> to cause problems.
>
> Also see inline.
>
> 2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
> > I think by doing things like this, it may not be the best way.
> >
> > You mentioned you'd map the XML to typed objects in .NET.� How can I do
> > this?
>
> As you're using a dataset, this isn't really an option. A dataset as
> opposed to a collection of typed objects are two ways of handling data
> from data sources; it is arguable which way is better.
>
> The problem in your case, is that the XML generated as a result of
> passing an ArrayCollection to a web service method cannot be passed
> into the dataset's readXml method. (Even if it could by inferring a
> schema, it would be different to your database's schema.)
>
> The only way I know of to do seamless transfer of data without having
> to parse XML is to use WebORB. Otherwise you will have to parse the
> XML produced on both sides to re-create the dataset/object.
>
> > Instead of using arraycollection as dataprovider in my datagrid, can I use
> > another which would be much easier when I pass back to the .NET function?
>
> I wonder if it is possible to bind your datagrid directly to the e4x
> XML? That way you can pass the entire XML doc back to .NET via the web
> service, and hence you can re-create the dataset using
> dataset.readXML.
>
> > ____________ _________ _________ __
> > From: Sam Lai <samuel.lai@ gmail. com>
> > To: flexcoders@yahoogro ups.com
> > Sent: Friday, 3 July, 2009 13:52:12
> > Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> > Passed to .NET WebService
> >
> > Instead of using an array list and trying to emulate the type-less
> > abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
> > does the XML from your Flex app differ too wildly to do this?
> >
> > Are you using the XmlSerializer to deserialize this? Or are you using
> > WCF? Or are you doing it some other way, or manually?
> >
> > I'd provide an example, but I don't know enough details on your
> > situation to give something useful :)
> >
> > 2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:
> >>
> >>
> >> Hi Sam,
> >>
> >> Care to show some examples? I am parsing the arrayCollection into an
> >> ArrayList on .NET.� This is particularly not too appealing since I just
> >> discovered that for example, if one of the objects in the arraycollection
> >> would have an empty string value, the number of items inside the array is
> >> not reflected properly in .NET.
> >>
> >> Like:
> >>
> >> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> >> Value:"Select" },
> >> ��������������������������������������������������������{ID:"002",
> >> Value:"Choose" },
> >> ������������������������������������������������������� {ID:"003",
> >> Value:""},]) ;
> >>
> >> When I pass this var arrR into a .NET webservice and delegate it to an
> >> ArrayList, the items in the array list will have one of the arrays only
> >> containing 1 item (instead of 2).
> >>
> >> Adding to my problem is the fact that the arrays inside the array list
> >> when
> >> read in .NET should have the object ID and Value be in order but they are
> >> not.� This is further true when there are many items in the array
> >> collection.� Sometimes, the first item becomes the last one in the array
> >> list, and sometimes the order is not well.
> >>
> >> In any case, I am finding a solution on how I would be able to pass an
> >> ArrayCollection to .NET and be able to parse it properly.
> >>
> >> Thanks.
> >>
> >> ____________ _________ _________ __
> >> From: Sam Lai <samuel.lai@ gmail. com>
> >> To: flexcoders@yahoogro ups.com
> >> Sent: Thursday, 2 July, 2009 15:46:58
> >> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
> >> When
> >> Passed to .NET WebService
> >>
> >> How is it being parsed in .NET? You can parse it into a hashtable, or
> >> better yet, use a pre-defined object.
> >>
> >> Not sure why the order is different, but it is probably fragile to
> >> rely on the order in this case.
> >>
> >> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
> >>>
> >>>
> >>> Hi FlexCoders,
> >>>
> >>> I have an array collection which I am populating as follows:
> >>>
> >>> var oTemp:Object;
> >>> var xl:XMLList = _xmlData.children( );
> >>> var i:int;
> >>> for(i = 0; i < xl.length(); i++)
> >>> {
> >>> �oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
> >>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
> >>> IND_TAG:xl[i] .IND.text( )};
> >>> �arrDP.addItem( oTemp);
> >>> }
> >>> Now, when I pass back this Array Collection back into a web service, the
> >>> fields are not in order as I have added them into the array collection.
> >>>
> >>> I am expecting that in my Web Service, when I parse this arraycollection
> >>> (via arraylist), I would be getting the same order of columns as I have
> >>> added them, i.e. the first array in the array list would have element 0
> >>> to
> >>> be the value I placed in the ID.
> >>>
> >>> Since the arraylist does not have the field tag (represented by ID_TAG,
> >>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
> >>> my
> >>> part since I can only reference the value via the index on the array.
> >>>
> >>> Now, how would I be able to include the tags inside array collection such
> >>> that when I read them as an array list in my .NET webservice, I know
> >>> which
> >>> element I am referring to in a particular index.
> >>>
> >>> Thanks.
> >>>
> >>> Regards,
> >>> Angelo
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>





     

Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tracy,

I would certainly appreciate if you could point me in the right direction on using XMLListCollection and sending it back to .NET as a string. 

Thanks.

Regards,

Angelo




________________________________
From: Tracy Spratt <tracy@...>
To: flexcoders@...
Sent: Tuesday, 7 July, 2009 4:45:56
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService





Why not use XMLListCollection and send the xml to .net as a string?  There is little value in building an ArrayCollection of generic obects.  You can sort/filter an XMLListCollection.
 
XML is more verbose than some other methods, but if bandwidth is truly an issue, then you should be looking at a binary protocol.
 
Tracy Spratt,
Lariat Services, development services available

________________________________

From:flexcoders@yahoogro ups.com [mailto: flexcoders@yahoogro ups.com ] On Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcoders@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
 




Hi Sam,
Basically this is the process which I am using.
 
.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return the dataset as XML string via the command DataSet.GetXML.
 
Flex
In the event handler of my webservice method call, I parse the string into XML, then ArrayCollection via the following codes:
 
private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollecti on = new ArrayCollection;
_xmlData = XML(event.result) ;
var oTemp:Object;
var xl:XMLList = _xmlData.children( );
var i:int;
for(i = 0; i < xl.length(); i++) 
{
 oTemp = {NAME:xl[i]. NAME.text( ), TEAM:xl[i].TEAM. text(),
    JERSEY :xl[i] .JERSEY.text( ), MANAGER:xl[i] .MANAGER. text()};
 arrDP.addItem( oTemp);
}
 
and in my datagrid, I am setting its dataProvider to the arrDP variable.
 
I used Array Collection because I implemented a search and filter functionality which searches and filters the data accordingly for the dataprovider which is then reflected back to the datagrid.
Now, when I need to return the ArrayCollection to .NET, I simply pass the same as a parameter to a .NET function which accepts ArrayList as parameter.
 
.NET
Once the function receieves the arraycollection (which is then now an array list), I get the arrays inside the arraylist and get the values inside the array. 
 
I think by doing things like this, it may not be the best way.
 
You mentioned you'd map the XML to typed objects in .NET.  How can I do this?
 
Instead of using arraycollection as dataprovider in my datagrid, can I use another which would be much easier when I pass back to the .NET function?
 
Whats the best way to interact large set of data (datasets) between .NET and Flex?
 
Thanks a lot.

 
 

________________________________

From:Sam Lai <samuel.lai@gmail. com>
To: flexcoders@yahoogro ups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:

>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> Value:"Select" },
>                                                         {ID:"002",
> Value:"Choose" },
>                                                         {ID:"003",
> Value:""},]) ;
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list when
> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@gmail. com>
> To: flexcoders@yahoogro ups.com
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0 to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know which
>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
>
 



     

RE: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Tracy Spratt-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

var sXML:String = "<root>";

sXML += myXMLListCollection.toXMLSTring();

sXML+= "</root";

myWebService.setUserPermits(sXML,sSID);

 

on the .net side:

<WebMethod(Description:="Updates multiple UserPermit records")> _

  Public Function setUserPermits(ByVal sRowsXml As String, ByVal sSId As
String) As DataTable

.

 

 

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@... [mailto:flexcoders@...] On
Behalf Of Angelo Anolin
Sent: Tuesday, July 07, 2009 8:09 PM
To: flexcoders@...
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

 






Hi Tracy,

 

I would certainly appreciate if you could point me in the right direction on
using XMLListCollection and sending it back to .NET as a string.  

 

Thanks.

 

Regards,

 

Angelo

 

  _____  

From: Tracy Spratt <tracy@...>
To: flexcoders@...
Sent: Tuesday, 7 July, 2009 4:45:56
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

Why not use XMLListCollection and send the xml to .net as a string?  There
is little value in building an ArrayCollection of generic obects.  You can
sort/filter an XMLListCollection.

 

XML is more verbose than some other methods, but if bandwidth is truly an
issue, then you should be looking at a binary protocol.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogro ups.com [mailto: flexcoders@yahoogro ups.com ] On
Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcoders@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

 





Hi Sam,

Basically this is the process which I am using.

 

.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return
the dataset as XML string via the command DataSet.GetXML.

 

Flex
In the event handler of my webservice method call, I parse the string into
XML, then ArrayCollection via the following codes:

 

private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollecti on = new ArrayCollection;

_xmlData = XML(event.result) ;
var oTemp:Object;
var xl:XMLList = _xmlData.children( );

var i:int;
for(i = 0; i < xl.length(); i++)  
{
 oTemp = {NAME:xl[i]. NAME.text( ), TEAM:xl[i].TEAM. text(),
    JERSEY :xl[i] .JERSEY.text( ), MANAGER:xl[i] .MANAGER. text()};
 arrDP.addItem( oTemp);
}

 

and in my datagrid, I am setting its dataProvider to the arrDP variable.

 

I used Array Collection because I implemented a search and filter
functionality which searches and filters the data accordingly for the
dataprovider which is then reflected back to the datagrid.

Now, when I need to return the ArrayCollection to .NET, I simply pass the
same as a parameter to a .NET function which accepts ArrayList as parameter.

 

.NET
Once the function receieves the arraycollection (which is then now an array
list), I get the arrays inside the arraylist and get the values inside the
array.

 

I think by doing things like this, it may not be the best way.

 

You mentioned you'd map the XML to typed objects in .NET.  How can I do
this?

 

Instead of using arraycollection as dataprovider in my datagrid, can I use
another which would be much easier when I pass back to the .NET function?

 

Whats the best way to interact large set of data (datasets) between .NET and
Flex?

 

Thanks a lot.


 

 

  _____  

From: Sam Lai <samuel.lai@gmail. com>
To: flexcoders@yahoogro ups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
Passed to .NET WebService

Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_anolin@ <mailto:angelo_anolin%40yahoo.com>
yahoo.com>:

>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> Value:"Select" },
>                                                         {ID:"002",
> Value:"Choose" },
>                                                         {ID:"003",
> Value:""},]) ;
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list
when

> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@gmail. com <mailto:samuel.lai%40gmail.com> >
> To: flexcoders@yahoogro ups.com <mailto:flexcoders%40yahoogroups.com>
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order
When

> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0
to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know
which

>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
>

 

 




Re: ArrayCollection Does Not Show Items In Order When Passed to .NET WebService

by Angelo Anolin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Tracy,
apologies that it took me quite a while to reply and continue this. been sidetracked on another project.

anyway, when I have passed the xmllistcollection as string to .net, what method would i use to parse the information in the .net side?

thanks.

regards,

Angelo



________________________________
From: Tracy Spratt <tracy@...>
To: flexcoders@...
Sent: Wednesday, 8 July, 2009 12:48:27
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService





var sXML:String = “<root>”;
sXML += myXMLListCollection .toXMLSTring( );
sXML+= “</root”;
myWebService. setUserPermits( sXML,sSID) ;
 
on the .net side:
<WebMethod(Descripti on:="Updates multiple UserPermit records")> _
  Public Function setUserPermits(ByVal sRowsXml As String, ByVal sSId As String) As DataTable

 
 
 
Tracy Spratt,
Lariat Services, development services available

________________________________

From:flexcoders@yahoogro ups.com [mailto: flexcoders@yahoogro ups.com ] On Behalf Of Angelo Anolin
Sent: Tuesday, July 07, 2009 8:09 PM
To: flexcoders@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
 




Hi Tracy,
 
I would certainly appreciate if you could point me in the right direction on using XMLListCollection and sending it back to .NET as a string. 
 
Thanks.
 
Regards,
 
Angelo
 

________________________________

From:Tracy Spratt <tracy@nts3rd. com>
To: flexcoders@yahoogro ups.com
Sent: Tuesday, 7 July, 2009 4:45:56
Subject: RE: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
Why not use XMLListCollection and send the xml to .net as a string?  There is little value in building an ArrayCollection of generic obects.  You can sort/filter an XMLListCollection.
 
XML is more verbose than some other methods, but if bandwidth is truly an issue, then you should be looking at a binary protocol.
 
Tracy Spratt,
Lariat Services, development services available

________________________________

From:flexcoders@yahoogro ups.com [mailto: flexcoders@yahoogro ups.com ] On Behalf Of Angelo Anolin
Sent: Friday, July 03, 2009 2:09 AM
To: flexcoders@yahoogro ups.com
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
 



Hi Sam,
Basically this is the process which I am using.
 
.NET
Retrieve records from Oracle DB and store the same into a dataset.  Return the dataset as XML string via the command DataSet.GetXML.
 
Flex
In the event handler of my webservice method call, I parse the string into XML, then ArrayCollection via the following codes:
 
private var _xmlData:XML;
[Bindable] private var arrDP:ArrayCollecti on = new ArrayCollection;
_xmlData = XML(event.result) ;
var oTemp:Object;
var xl:XMLList = _xmlData.children( );
var i:int;
for(i = 0; i < xl.length(); i++) 
{
 oTemp = {NAME:xl[i]. NAME.text( ), TEAM:xl[i].TEAM. text(),
    JERSEY :xl[i] .JERSEY.text( ), MANAGER:xl[i] .MANAGER. text()};
 arrDP.addItem( oTemp);
}
 
and in my datagrid, I am setting its dataProvider to the arrDP variable.
 
I used Array Collection because I implemented a search and filter functionality which searches and filters the data accordingly for the dataprovider which is then reflected back to the datagrid.
Now, when I need to return the ArrayCollection to .NET, I simply pass the same as a parameter to a .NET function which accepts ArrayList as parameter.
 
.NET
Once the function receieves the arraycollection (which is then now an array list), I get the arrays inside the arraylist and get the values inside the array. 
 
I think by doing things like this, it may not be the best way.
 
You mentioned you'd map the XML to typed objects in .NET.  How can I do this?
 
Instead of using arraycollection as dataprovider in my datagrid, can I use another which would be much easier when I pass back to the .NET function?
 
Whats the best way to interact large set of data (datasets) between .NET and Flex?
 
Thanks a lot.

 
 

________________________________

From:Sam Lai <samuel.lai@gmail. com>
To: flexcoders@yahoogro ups.com
Sent: Friday, 3 July, 2009 13:52:12
Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When Passed to .NET WebService
Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_anolin@ yahoo.com>:

>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollectio n = new ArrayCollection( [{ID:"001" ,
> Value:"Select" },
>                                                         {ID:"002",
> Value:"Choose" },
>                                                         {ID:"003",
> Value:""},]) ;
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list when
> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ____________ _________ _________ __
> From: Sam Lai <samuel.lai@gmail. com>
> To: flexcoders@yahoogro ups.com
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0 to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know which
>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
>