You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mark goldin <ma...@gmail.com> on 2015/12/03 02:53:46 UTC

FileReference save

I am working with code that saves a large ArrayCollection into an csv file.
When I open the file I see it's a comma delimited. I am not sure I
understand where these commas are coming from. The data itself does not
have any commas. Any idea?

Thanks

Re: FileReference save

Posted by jude <fl...@gmail.com>.
You're passing in an ArrayCollection as the data to save? I'm guessing
there is a ArrayCollection.toString() conversion going on. Then it's
looking at each object and splitting the property values with commas.

var ant = {name:Z,class:worker};
var ant2 = {name:Weaver,class:warrior};

var output = collection.toString();
trace(output);
// Z,worker
// Weaver,warrior

It implements IExternalizable. That adds readExternal and writeExternal
methods.

I would call those methods on a new object and then check it's value:

var object  = myCollection.toString();
var object2  = myCollection.writeExternal(output:IDataOutput);



On Thu, Dec 3, 2015 at 1:55 AM, mark goldin <ma...@gmail.com> wrote:

> Something like this:
> var chartDataFile:FileReference = new FileReference();
> chartDataFile.save(projectData, "data.csv");
>
> projectData is an ArrayCollection.
> Data.csv looks like this:
> 0-15-2015
>
> 14:37:00,14,1,0.5447975,0.5447975,-0.9986115,-0.9986115,19,21.9765,325.0004,
> 10-15-2015
>
> 14:37:05,14,1,0.5447975,0.5447975,-0.9986115,-0.9986115,19,21.9765,325.0004,
> 10-15-2015
>
> 14:37:10,14,1,0.5447975,0.5447975,-0.9986115,-0.9986115,19,21.9765,325.0004,
>
> I am not sure how these commas are making in.
>
> On Wed, Dec 2, 2015 at 8:10 PM Justin Mclean <ju...@classsoftware.com>
> wrote:
>
> > Hi,
> >
> > > I dont see any formatting in code. I see an ArrayCollection getting
> saved
> > > into an CSV file.
> >
> > Can you post a link to the code that does this?
> >
> > Thanks,
> > Justin
> >
>

Re: FileReference save

Posted by mark goldin <ma...@gmail.com>.
Something like this:
var chartDataFile:FileReference = new FileReference();
chartDataFile.save(projectData, "data.csv");

projectData is an ArrayCollection.
Data.csv looks like this:
0-15-2015
14:37:00,14,1,0.5447975,0.5447975,-0.9986115,-0.9986115,19,21.9765,325.0004,
10-15-2015
14:37:05,14,1,0.5447975,0.5447975,-0.9986115,-0.9986115,19,21.9765,325.0004,
10-15-2015
14:37:10,14,1,0.5447975,0.5447975,-0.9986115,-0.9986115,19,21.9765,325.0004,

I am not sure how these commas are making in.

On Wed, Dec 2, 2015 at 8:10 PM Justin Mclean <ju...@classsoftware.com>
wrote:

> Hi,
>
> > I dont see any formatting in code. I see an ArrayCollection getting saved
> > into an CSV file.
>
> Can you post a link to the code that does this?
>
> Thanks,
> Justin
>

Re: FileReference save

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> I dont see any formatting in code. I see an ArrayCollection getting saved
> into an CSV file. 

Can you post a link to the code that does this?

Thanks,
Justin

Re: FileReference save

Posted by mark goldin <ma...@gmail.com>.
I dont see any formatting in code. I see an ArrayCollection getting saved
into an CSV file. If I open it with Notepad I see that the file is a comma
delimited. Have these commas been added by the output formatting? If yes,
how can I use different delimiters?

Thanks

On Wed, Dec 2, 2015 at 7:58 PM Justin Mclean <ju...@classsoftware.com>
wrote:

> Hi,
>
> CSV is comma-separated values, so I guess from the formatting into CSV? OR
> do you mean comma’s in the data rather than as a separator?
>
> Thanks,
> Justin

Re: FileReference save

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

CSV is comma-separated values, so I guess from the formatting into CSV? OR do you mean comma’s in the data rather than as a separator?

Thanks,
Justin