0

I have data like so (I got it by doing console.log($scope.exportData)):

[Object, Object, Object, Object, Object]
0: Object
AdjustmentFactorsCustomerSatisfaction: -40
AdjustmentFactorsEmployeeCompetence: -30
AdjustmentFactorsStaffTurnovers: -50

as you can tell I have 5 objects, I am looking to format this data for a CSV file, so each of those values are column names: AdjustmentFactorsCustomerSatisfaction, AdjustmentFactorsEmployeeCompetence and the data is in 1 row per an object. How would I do this. The example I am using for the CSV has data like this and it works:

var data = [["name1", "city1", "some other info"], ["name2", "city2", "more info"]];

it return no column names.

This what I would like it to look like:

emergenciesGuidelines emergenciesGuidelines emergenciesGuidelines
(Object 1 data (-40)) (Object 1 data (-30))  (Object 1 data (-50))
(Object 2 data)       (Object 2 data)        (Object 2 data)
4
  • What do you want the CSV to look like? Can you include it in the question? Are all the objects the same? I.e., do they all have the same properties (but different values)? Commented Jun 20, 2014 at 19:49
  • Maybe here stackoverflow.com/questions/11257062/… Commented Jun 20, 2014 at 19:54
  • Hi Matt Burland, you are correct all the objects are the same as they have the same properties but didnt values. Commented Jun 20, 2014 at 20:00
  • How do you know which order to put the properties in? Note that the order of properties in a javascript object are not guaranteed. So just becuase AdjustmentFactorCustomerSatisfaction is the first property of object 1, doesn't mean it will be the first property of object 2. Commented Jun 20, 2014 at 21:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.