all groups > flash data integration > december 2006 >
You're in the

flash data integration

group:

2 dimensional array to dataprovider?


2 dimensional array to dataprovider? jgeorgiou
12/8/2006 12:00:00 AM
flash data integration: Hi all,
I have the following problem.
Somewhere a get data to a 2 dimensional array. Is there any clever way to
transform the array to a datagrid dataprovider without make a "for" loop?
Thanks in advance
Re: 2 dimensional array to dataprovider? cycle1
12/8/2006 2:41:17 PM
This probably depends on what server-side technology you're using.
I'm using Asp.net 2.0 and I have to use for loops to get data in and out.
I can retrieve a one-dimensional array of a custom data type (struct) using a
single call to my Asp.net web service:
public struct LayoutRecord
{
public int layoutID;
public string action;
public int objectID;
public string objectType;
public int colour;
public int width;
public Boolean filled;
public int startX;
public int startY;
public int endX;
public int endY;
public int midX;
public int midY;
}
[WebMethod(Description = "Loads a set of layoutRecords from the database")]
public LayoutRecord[] LoadLayoutRecords(int layoutID)
{
SqlConnection conn = new SqlConnection(_connString);
...etc

Which Flash can then iterate through using a for loop

However, I did find that in order to send a one-dimensional array back in to
my web service I have to send arrays of a single primitive type (e.g int,
string), not custom defined ones.
e.g.
[WebMethod(Description = "Saves a set of layoutRecords to the database")]
public Boolean AddLayoutRecords(int layoutID, string[] action, int[]
objectID, string[] objectType, int[] colour, int[] width, Boolean[] filled,
int[] startX, int[] startY, int[] endX, int[] endY, int[] midX, int[] midY)
{
where the [] in the above are actually [ followed by ] as used by c# to
indicate an array.

A very good book on the subject is 'ASP.Net for Flash' by Ryan Moore. I
believe Friends of Ed also publish one on PHP though I don't use it.

Good luck
AddThis Social Bookmark Button