Link to home
Start Free TrialLog in
Avatar of aduvall
aduvall

asked on

Export Flash Builder As3 arrayCollection as csv in the AC original order.

I have an ArrayCollection that I am trying to save to a folder on a web server to csv.

I don't mind using a combination of AS3 and PHP to accomplish this. I tried first sending the data as XML to a php script (magicparser) and then converting it to CSV but I could not get it to work as the csv was not in the order that it was originally in the ArrayCollection. I would like to know how to get this in it's proper order.

 If the CSV can be generated from Flex then auto uploaded to the server for further processing that would be fine as well.


This is how the CSV file should look
H,TUS test,TUS test,02/8/2012,TUS test,1234567890,555,05/19,Visa,
D,MBE37602SH,MBE37602SH,4,EA,54.41,345678,2/8/2012,,
D,MBE37602SH,MBE37602SH,4,EA,54.41,345678,2/8/2012,,

This is what I get


   ,TUS TEST,05/19,Visa,,TUS TEST,555,1234567890,02/8/2012,H,TUS test
  ,MBE37602SH,2/8/2012,,,MBE37602SH,345678,54.41,4,D,EA
 ,MBE37602SH,2/8/2012,,,MBE37602SH,345678,54.41,4,D,EA

This is the ArrayCollection

private var items:ArrayCollection = new ArrayCollection([
{type:"H", cnum:"TUS TEST", fg:"TUS TEST", qty:"02/8/2012", uom:"TUS test", price:"1234567890", po:"555", ddate:"05/19", efield:"Visa", ffield:""},
{type: "D", cnum:"MBE37602SH", fg:"MBE37602SH", qty:"4", uom:"EA", price:"54.41", po:"345678", ddate:"2/8/2012", efield:"", ffield:""},
{type: "D", cnum:"MBE37602SH", fg:"MBE37602SH", qty:"4", uom:"EA", price:"54.41", po:"345678", ddate:"2/8/2012", efield:"", ffield:""}]);
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aduvall
aduvall

ASKER

This solution worked well for me.  Thank You