Perfect!
I had forgotton to change payload from string to JSON.
Now works as you describe.
Thank you for spending time to do this, it is much appreciated. I will now try to modify to achieve the attached report, then have it emailed once a day!!!
Here’s the PFDMake file layout for those that are interested:
var dd =
{
"content": [
{
// Header and date in the same line
"columns": [
{
"text": 'DYR Daily Tank Report',
"style": 'header',
"alignment": 'left'
},
{
"text": '30/09/2024',
"style": 'header',
"alignment": 'right'
}
],
"margin": [0, 0, 0, 10] // Adding margin below the header line
},
// Tank 1 Table
{
"style": "tableExample",
"alignment": "center",
"table": {
"widths": ['*', '*', '*'],
"headerRows": 1,
'body': [
[{ "text": 'Tank 1', "style": 'tableHeader', 'colSpan': 3, "alignment": "center" }, {}, {}],
[{ "text": 'Movement Time', "style": 'tableHeader', "alignment": "center" },
{ "text": 'In/Out', "style": 'tableHeader', "alignment": "center" },
{ "text": 'Volume', "style": 'tableHeader', "alignment": "center" }],
['10:49:08', 'IN', '100'],
['10:49:47', 'IN', '50'],
['10:50:11', 'IN', '50'],
['10:50:39', 'IN', '50'],
[{ 'colSpan': 3, "text": ''}, {}, {}],
[{ "text": 'Total Movements In:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '4'],
[{ "text": 'Total Movements Out:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '0'],
[{ "text": 'Total Volume In:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '250'],
[{ "text": 'Total Volume Out:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '0']
]
}
},
// Tank 2 Table
{
"style": "tableExample",
"alignment": "center",
"table": {
"widths": ['*', '*', '*'],
"headerRows": 1,
'body': [
[{ "text": 'Tank 2', "style": 'tableHeader', 'colSpan': 3, "alignment": "center" }, {}, {}],
[{ "text": 'Movement Time', "style": 'tableHeader', "alignment": "center" },
{ "text": 'In/Out', "style": 'tableHeader', "alignment": "center" },
{ "text": 'Volume', "style": 'tableHeader', "alignment": "center" }],
['10:49:47', 'IN', '100'],
['10:50:11', 'IN', '50'],
['10:50:39', 'IN', '50'],
[{ 'colSpan': 3, "text": ''}, {}, {}],
[{ "text": 'Total Movements In:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '3'],
[{ "text": 'Total Movements Out:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '0'],
[{ "text": 'Total Volume In:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '200'],
[{ "text": 'Total Volume Out:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '0']
]
}
},
// Tank 3 Table
{
"style": "tableExample",
"alignment": "center",
"table": {
"widths": ['*', '*', '*'],
"headerRows": 1,
'body': [
[{ "text": 'Tank 3', "style": 'tableHeader', 'colSpan': 3, "alignment": "center" }, {}, {}],
[{ "text": 'Movement Time', "style": 'tableHeader', "alignment": "center" },
{ "text": 'In/Out', "style": 'tableHeader', "alignment": "center" },
{ "text": 'Volume', "style": 'tableHeader', "alignment": "center" }],
['10:50:11', 'IN', '50'],
['10:50:39', 'IN', '100'],
[{ 'colSpan': 3, "text": ''}, {}, {}],
[{ "text": 'Total Movements In:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '2'],
[{ "text": 'Total Movements Out:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '0'],
[{ "text": 'Total Volume In:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '150'],
[{ "text": 'Total Volume Out:', "style": 'tableHeader', 'colSpan': 2, "alignment": 'right' }, '', '0']
]
}
}
],
"styles": {
"header": { "fontSize": 18, "bold": true, "margin": [0, 0, 0, 10] },
"tableExample": { "margin": [0, 0, 0, 50], "color": "blue" },
"tableHeader": { "bold": true, "fontSize": 13, "color": "black" }
},
"defaultStyle": { "alignment": "center" }
}