Hi,
I’m new to MongoDB and I have the challenge to convert CSV files to the below format.
$category_amount = array(
array("UserName"=>"User1","Leads"=>32000,"Closed Won"=>20000,"Closed Lost"=>12000),
array("UserName"=>"User2","Leads"=>43000,"Closed Won"=>36000,"Closed Lost"=>7000),
array("UserName"=>"User3","Leads"=>54000,"Closed Won"=>39000,"Closed Lost"=>15000),
array("UserName"=>"User4","Leads"=>23000,"Closed Won"=>18000,"Closed Lost"=>5000),
array("UserName"=>"User5","Leads"=>12000,"Closed Won"=>6000,"Closed Lost"=>6000),
);
CSV Sample:
username,stage_en,price <== Columns Header
Ashraf Shehadeh,Closed Lost,58
Mohammad Allan,Closed Lost,580
Jamil Mahmoud ,Closed Lost,556.8
Ashraf Shehadeh,Closed Won,406
Leen Ibrahim,Closed Lost,0
Ashraf Shehadeh,Closed Lost,928
Mohammad Allan,Closed Lost,928
Mohammad Allan,Closed Won,522
Leen Ibrahim,Closed Lost,0
Agent 16,Closed Lost,0
What I need is to convert the list to a formatted array to be able to apply it as a Chart datasource.
Thanks,