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:""}]);
Apache FlexPHP

Avatar of undefined
Last Comment
aduvall

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
dgofman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
aduvall

ASKER
This solution worked well for me.  Thank You
Your help has saved me hundreds of hours of internet surfing.
fblack61