Hey Gordon,
Thanks for the reply. I got it to work using split like you said.
I'm now stuck trying to put the data in a datagrid. The data is now
in an array but I'm not sure how you reference each element for a
column in the data provider or the data grid.
The data looks something like this
(Record 1)
09/17/07 < element 0
245 < element 1
37 < etc
36
44
194
100
2
45
4
462
63906
(record 2)
09/18/07
263
41
34
43
197
95
1
45
3
459
63906
And my datagrid would be
<mx:DataGrid id="dg" width="100%"
height="100%" rowCount="5" dataProvider="{array}" >
<mx:columns>
<mx:DataGridColumn
headerText="Date" textAlign="center" />
<mx:DataGridColumn
headerText="CoreTechInit" textAlign="center"/>
<mx:DataGridColumn
headerText="ServerInit" textAlign="center"/>
<mx:DataGridColumn
headerText="ImportPackets" textAlign="center"/>
<mx:DataGridColumn
headerText="Merge" textAlign="center"/>
<mx:DataGridColumn
headerText="Layout" textAlign="center"/>
<mx:DataGridColumn
headerText="Render" textAlign="center"/>
<mx:DataGridColumn
headerText="CalcTime" textAlign="center"/>
<mx:DataGridColumn
headerText="RenderOverhead" textAlign="center"/>
<mx:DataGridColumn
headerText="AppOverhead" textAlign="center"/>
<mx:DataGridColumn
headerText="Total" textAlign="center"/>
<mx:DataGridColumn
headerText="FileSize" textAlign="center"/>
</mx:columns>
</mx:DataGrid>
So my question now is How do I associate each array element with its
proper place holder in the datagrid?? Do I have to create and
associative array or something? I'm assuming it has something to do
with the datafield of each column?
Any help is greaty appreciated
Thanks
Dylan
--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]>
wrote:
>
> Is this a file on the server whose contents you're getting as a big
> String? If so, you could probably just use the split() method of
String
> to first split on carriage-return or newline, and then split each
line
> on whitespace.
>
> - Gordon
>
> ________________________________
>
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of djdyland
> Sent: Wednesday, September 19, 2007 10:36 AM
> To: [email protected]
> Subject: [flexcoders] Parsing a flat file in flex?
>
>
>
> Can anyone point me in the direction of how this might be done?
> I want to parse or convert a flat file separated by spaces into
xml or
> some sort of structure I can then use a dataprovider inside flex..
The
> file looks something like this
>
> Date CoreTechInit ServerInit ImportPackets Merge
> 12/16/04 0 3 43 47
> 12/17/04 0 9 43 49
> 12/18/04 0 9 40 53
> 12/19/04 0 6 40 46
> 12/20/04 0 6 40 47
> 01/03/05 0 3 46 56
> 01/04/05 0 6 46 46
>
> Thanks
> Dylan
>