Hello guys,
I want to export a table as pdf using an external API (PDFGeneratorAPI). The data I want to send is always the same format but not always the same size(Number of date can change according to the billing frequency of my customer).
The problem here is that the final format of my JSON is really nice for what I want to build but I need the key of first object (table3.columns) into Item have the keys equal to their values like this otherwise the api will not be able to loop on the whole of my array :
"ac_tail": "ac_tail",
"category": "category",
To build this JSON, I get the data like this (table3is already an array so I concat it into table3.columns previously put between [] to declare it also as an array :
{
"id" : "111111",
"name" : "APPENDICES",
"item" : {{[table3.columns].concat(table3.displayedData)}}
}
Here is an example of my final JSON where item is an array of object :
{
"id": "11111",
"name": "APPENDICES",
"item": [
{
"0": "ac_tail",
"1": "category",
"2": "ac_type",
"3": "2022-01-01",
"4": "2022-02-01",
"5": "2022-03-01",
"6": "2022-04-01",
"7": "2022-05-01",
"8": "2022-06-01"
},
{
"ac_tail": "AAAAA",
"category": "SA",
"ac_type": "A320",
"2022-01-01": 30,
"2022-02-01": 28,
"2022-03-01": 26,
"2022-04-01": 28,
"2022-05-01": 31,
"2022-06-01": 28
},
{
"ac_tail": "ABBBBB",
"category": "SA",
"ac_type": "A320",
"2022-01-01": null,
"2022-02-01": 13,
"2022-03-01": 31,
"2022-04-01": 16,
"2022-05-01": 31,
"2022-06-01": 28
}
]
}
How can I achieve that into on Retool?
Thank you