I am currently sending a query and getting the data returned from my board:
const query = `{
boards(ids: ${state.mondayBoardId}) {
groups(){
title
items(limit: 50){
column_values{
text
}
}
}
}
}`
The query returns an array of objects (rows). Each object or row has an array of items (column values).
[{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
1. column_values: Array(9)
1. 0: {text: "ARI"}
2. 1: {text: "Fitzgerald"}
3. 2: {text: "Larry"}
4. 3: {text: "WR"}
5. 4: {text: "11"}
6. 5: {text: "Arizona Cardinals"}
7. 6: {text: "Cardinals"}
8. 7: {text: ""}
9. 8: {text: ""}
10. length: 9
2. 1: {column_values: Array(9)}
3. 2: {column_values: Array(9)}
4. 3: {column_values: Array(9)}
5. 4: {column_values: Array(9)}
6. 5: {column_values: Array(9)}
If I’m referencing a column value I can’t call it out as a key:value pair but instead have to get the value by index. If I for some reason change the order of my columns in a board it will throw off the index value.
Is there a way to flatten the return to get an array of objects each having key:value pairs for each column? Something more like this?
1. Array(34)
1. 0:
1. jerseyNumber: "jerseyNumber"
2. nameFirst: "nameFirst"
3. nameLast: "nameLast"
4. position: "position"
5. teamFullName: "teamFullName"
6. teamMascot: "teamMascot"
7. teamTri: "teamTri"
8. __proto__: Object
2. 1: {teamTri: "ARI", nameLast: "Fitzgerald", nameFirst: "Larry", position: "WR", jerseyNumber: "11", …}
3. 2: {teamTri: "ATL", nameLast: "Jones", nameFirst: "Julio", position: "WR", jerseyNumber: "11", …}
4. 3: {teamTri: "BAL", nameLast: "Harbaugh", nameFirst: "John", position: "COACH", jerseyNumber: "11", …}
5. 4: {teamTri: "BUF", nameLast: "Kromer", nameFirst: "Aaron", position: "COACH", jerseyNumber: "11", …}
6. 5: {teamTri: "CAR", nameLast: "Newton", nameFirst: "Cam", position: "QB", jerseyNumber: "11", …}
7. 6: {teamTri: "CHI", nameLast: "Cutler", nameFirst: "Jay", position: "QB", jerseyNumber: "11", …}
8. 7: {teamTri: "CIN", nameLast: "Green", nameFirst: "A.J.", position: "WR", jerseyNumber: "11", …}
9. 8: {teamTri: "CLE", nameLast: "Greco", nameFirst: "John", position: "DE", jerseyNumber: "11", …}