Time Stamp Not Captured in pdf which I generated

I generate a pdf report from sql query,all the row is filled but Time stamp row is empty.

"This is My sql query"

var fromdate = msg.payload.From;
var todate = msg.payload.To;
msg.topic = "SELECT * FROM `node-red`.`final` where Date_Time between '" + fromdate + "' And '" + todate + "';";
return msg;

"This is Function node script for pdf report generation which i used"

let payload = {
content: [

    {
        pageSize: 'A4',
        pageOrientation: 'portrait',
        text: 'Confined Area Monitoring Report:', fontSize: 14, bold: true, margin: [0, 20, 0, 8]
    },
    {
        style: 'tableExample',

        table: {
            headerRows: 1,
            body: [
                Object.keys(msg.payload[0]).map(key => { return { text: key, style: 'tableHeader' } })
            ]
        },

        layout: 'lightHorizontalLines'
    },

],
    styles: {
    header: {
        fontSize: 18,
            bold: true,
                margin: [0, 10, 0, 10]
    },
    subheader: {
        fontSize: 16,
            bold: true,
                margin: [0, 10, 0, 5]
    },
    tableExample: {
        margin: [0, 5, 0, 15]
    },
    tableHeader: {
        bold: true,
            fontSize: 13,
                color: 'black'
    }
},
defaultStyle: {
    // alignment: 'justify'

}
};
Object.values(msg.payload).forEach(obj => {
    payload.content[1].table.body.push(Object.values(obj));
})

msg.payload = payload;

return msg;


report1


Admin Edit: wrap code in triple backticks to preserve formatting and improve readability

It is likely the Date_Time is a Date object. You should call .toString() (or similar) to get a string from the date object before adding it to the Doc Def content.

i.e. add something like:

const data = msg.payload.map(e=> {
  e.Date_Time =   e.Date_Time.toString()
  return e
}
// use data when populating the doc def content
// ...
// ...
// ...
return msg;

I am trying to add this but error is coming.I am new on node red
could you please send the whole script to generate pdf with time stamp.
Thanks

What error - what does it say exactly?

Also, show us the schema of your database so I can understand what the field Date_Time is.

Also, a sample of data copied from the debug would help. (use the "Copy Value" button against one of the array entries on the debug panel)

sample data from the debug

[{"Date_Time":"2023-05-30T07:37:59.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:38:10.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:38:21.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:38:32.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:38:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:38:53.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:39:03.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:39:14.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:40:22.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:40:32.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:40:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:40:52.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:41:02.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:41:13.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:41:23.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:41:33.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:41:44.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:41:54.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:42:05.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:42:16.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:42:26.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:42:58.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:43:08.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:43:19.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:43:30.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:43:40.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:43:51.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:44:02.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:44:13.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:44:23.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:44:34.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:44:45.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:44:56.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:45:07.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:45:18.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:45:29.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:45:40.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:45:50.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:46:01.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:46:12.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:46:22.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:46:32.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:46:43.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:46:54.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:47:05.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:47:15.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:47:26.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:47:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:47:48.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:47:58.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:48:09.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:48:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:48:31.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:48:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:48:53.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:49:04.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:49:15.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:49:26.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:49:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:49:48.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:49:59.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:50:09.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:50:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:50:31.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:50:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T07:50:53.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:12:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:12:47.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:12:58.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:13:08.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:13:19.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:13:29.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:13:40.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:13:51.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:02.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:12.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:16.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:26.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:47.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:14:58.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:15:08.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:15:19.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:15:29.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:15:40.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:15:50.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:16:00.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:16:11.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:16:21.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:16:32.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:16:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:16:53.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:17:03.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:17:13.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:17:24.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:17:34.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:17:45.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:17:55.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:18:06.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:18:17.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:18:27.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:18:38.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:18:49.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:00.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:10.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:31.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:41.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:52.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:19:59.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:20:09.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:20:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:20:59.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:21:09.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:21:46.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:22:49.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:22:59.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:23:09.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:23:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:23:30.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:23:40.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:23:50.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:24:29.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:24:39.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:24:49.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:25:00.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:25:11.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:25:21.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:25:31.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:25:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:25:53.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:26:03.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:26:13.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:26:24.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:26:35.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:26:45.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:26:55.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:27:06.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:27:16.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:27:27.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:27:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:27:47.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:27:57.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:28:07.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:28:17.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:28:28.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:28:39.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:28:50.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:29:00.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:29:11.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:29:22.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:29:32.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:29:42.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:30:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:30:30.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:30:41.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:30:52.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:31:03.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:31:13.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:31:24.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:31:34.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:31:45.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:31:56.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:32:06.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:32:16.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:32:27.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:32:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:32:47.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:32:58.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:33:09.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:33:20.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:33:30.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:33:40.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:33:51.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:34:01.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:34:12.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:34:23.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:34:34.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:34:45.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:34:56.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:35:06.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:35:14.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:35:24.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:35:35.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:35:45.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:35:55.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:36:06.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:36:17.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:36:28.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:36:38.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:36:49.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:37:00.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:37:11.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:37:22.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:37:32.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:37:43.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:37:54.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:38:04.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:38:15.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:38:26.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:38:37.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:38:47.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:38:58.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:39:03.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:39:13.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:39:24.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:39:34.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:39:44.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:39:54.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:40:04.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:40:14.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:40:24.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:40:34.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:40:44.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:40:54.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:41:04.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:41:15.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:41:26.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:41:36.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:41:46.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:41:56.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:42:07.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:42:18.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:42:29.000Z","CO":0,"OX":0,"Lux":0,"Temp":0},{"Date_Time":"2023-05-30T08:42:39.000Z","CO":0,"OX":0,"Lux":0,"Temp":0}]

admin edit: fixed json sample data and wrapped in triple backticks

And this :point_up:

Pdf is not generated when i add in existing function node .I am little bit confused wheather i have to add new function node and write this script which is given by you or i have to add add it on existing one.

TypeError: Cannot read properties of undefined (reading 'toString')

let payload = {
content: [

    {
        pageSize: 'A4',
        pageOrientation: 'portrait',
        text: 'Confined Area Monitoring Report:', fontSize: 14, bold: true, margin: [0, 20, 0, 8]
    },
    {
        style: 'tableExample',

        table: {
            headerRows: 1,
            body: [
                Object.keys(msg.payload[0]).map(key => key.Date_Time = key.Date_Time.toString(),
                { return: { } })
            ]
        },

        layout: 'lightHorizontalLines'
    },

],
    styles: {
    header: {
        fontSize: 18,
            bold: true,
                margin: [0, 10, 0, 10]
    },
    subheader: {
        fontSize: 16,
            bold: true,
                margin: [0, 10, 0, 5]
    },
    tableExample: {
        margin: [0, 5, 0, 15]
    },
    tableHeader: {
        bold: true,
            fontSize: 13,
                color: 'black'
    }
},
defaultStyle: {
    // alignment: 'justify'

}
};
Object.values(msg.payload).forEach(obj => {
    payload.content[1].table.body.push(Object.values(obj));
})

msg.payload = payload;

return msg;

i use mysql query and pdfmake too, and have been generating timestamp in pdf without an issue.
i am not sure,if this would help you in anyway, but i get the datetime in below format from mysql

date_format(fdate,'%d-%b %H:%i') as 'From', which results in a string output in the form as shown below.

Could you please send me the whole script of function node to generate pdf.

[{"id":"755f5a5d6ca9eb11","type":"inject","z":"400bc99efba52b23","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"query3\":[{\"Date_Time\":\"2023-05-30T07:37:59.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:38:10.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:38:21.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:38:32.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:38:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:38:53.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:39:03.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:39:14.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:40:22.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:40:32.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:40:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:40:52.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:41:02.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:41:13.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:41:23.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:41:33.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:41:44.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:41:54.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:42:05.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:42:16.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:42:26.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:42:58.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:43:08.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:43:19.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:43:30.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:43:40.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:43:51.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:44:02.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:44:13.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:44:23.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:44:34.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:44:45.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:44:56.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:45:07.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:45:18.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:45:29.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:45:40.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:45:50.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:46:01.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:46:12.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:46:22.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:46:32.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:46:43.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:46:54.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:47:05.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:47:15.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:47:26.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:47:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:47:48.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:47:58.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:48:09.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:48:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:48:31.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:48:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:48:53.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:49:04.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:49:15.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:49:26.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:49:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:49:48.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:49:59.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:50:09.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:50:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:50:31.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:50:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T07:50:53.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:12:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:12:47.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:12:58.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:13:08.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:13:19.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:13:29.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:13:40.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:13:51.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:02.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:12.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:16.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:26.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:47.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:14:58.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:15:08.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:15:19.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:15:29.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:15:40.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:15:50.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:16:00.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:16:11.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:16:21.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:16:32.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:16:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:16:53.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:17:03.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:17:13.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:17:24.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:17:34.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:17:45.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:17:55.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:18:06.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:18:17.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:18:27.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:18:38.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:18:49.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:00.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:10.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:31.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:41.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:52.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:19:59.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:20:09.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:20:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:20:59.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:21:09.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:21:46.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:22:49.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:22:59.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:23:09.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:23:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:23:30.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:23:40.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:23:50.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:24:29.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:24:39.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:24:49.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:25:00.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:25:11.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:25:21.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:25:31.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:25:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:25:53.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:26:03.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:26:13.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:26:24.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:26:35.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:26:45.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:26:55.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:27:06.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:27:16.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:27:27.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:27:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:27:47.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:27:57.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:28:07.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:28:17.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:28:28.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:28:39.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:28:50.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:29:00.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:29:11.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:29:22.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:29:32.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:29:42.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:30:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:30:30.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:30:41.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:30:52.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:31:03.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:31:13.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:31:24.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:31:34.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:31:45.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:31:56.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:32:06.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:32:16.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:32:27.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:32:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:32:47.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:32:58.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:33:09.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:33:20.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:33:30.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:33:40.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:33:51.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:34:01.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:34:12.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:34:23.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:34:34.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:34:45.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:34:56.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:35:06.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:35:14.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:35:24.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:35:35.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:35:45.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:35:55.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:36:06.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:36:17.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:36:28.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:36:38.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:36:49.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:37:00.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:37:11.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:37:22.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:37:32.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:37:43.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:37:54.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:38:04.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:38:15.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:38:26.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:38:37.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:38:47.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:38:58.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:39:03.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:39:13.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:39:24.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:39:34.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:39:44.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:39:54.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:40:04.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:40:14.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:40:24.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:40:34.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:40:44.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:40:54.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:41:04.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:41:15.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:41:26.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:41:36.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:41:46.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:41:56.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:42:07.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:42:18.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:42:29.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0},{\"Date_Time\":\"2023-05-30T08:42:39.000Z\",\"CO\":0,\"OX\":0,\"Lux\":0,\"Temp\":0}]}","payloadType":"json","x":1360,"y":2730,"wires":[["2ee5126c87ad97a5","146318775e9a1e3d"]]},{"id":"146318775e9a1e3d","type":"change","z":"400bc99efba52b23","name":"","rules":[{"t":"set","p":"pdf_header00","pt":"flow","to":"PDF_HEADER","tot":"str"},{"t":"set","p":"sub_header00","pt":"flow","to":"SUB HEADER","tot":"str"},{"t":"set","p":"machine00","pt":"flow","to":"Machine-1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1550,"y":2730,"wires":[["89d80d50efd18773"]]},{"id":"89d80d50efd18773","type":"function","z":"400bc99efba52b23","name":"data to pdf","func":"///\nlet query3Data = []\nmsg.payload.query3.forEach(obj => { query3Data.push(Object.entries(obj).map(([key, value]) => { return !isNaN(value) ? { text: value, alignment: 'right' } : { text: value, alignment: 'left' } }))})\n\n///\n\n\n\nlet tableData = {\n\n//    pageSize: 'a3',\n    pageSize: {\n    width: 1050,\n    height: 'auto'\n    },\n    pageOrientation: 'portrait',\n    content: [\n        { text: flow.get(\"pdf_header00\"), fontSize: 20, bold: true, alignment: 'center', color: 'green', margin: [12, 0, 12, 0] },\n        { text: ' ', fontSize: 20, bold: true, margin: [0, 0, 0, 0] },\n\n{ text: flow.get(\"sub_header00\"), fontSize: 14, bold: true, margin: [12, 5, 12, 5] },        \n\n        { text: '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------', fontSize: 10, bold: false, color: 'orange', margin: [0, 0, 0, 5] },\n\n//  Table 4\n        { text: flow.get(\"machine00\"), fontSize: 14, bold: true, margin: [12, 5, 12, 5] },\n        {\n            style: 'tableExample',\n            table: {\n                headerRows: 1,\n                widths: [100, 50, 50, 50, 50,],\n                body: [\n                    Object.keys(msg.payload.query3[0]).map(key => { return { text: key, alignment: key.startsWith(\"Duration\") ? \"right\" : \"left\",style: 'tableHeader' } }),\n                    ...query3Data\n                ]\n            },\n            layout: 'lightHorizontalLines'\n        },\n],\n\n    styles: {\n        header: {\n            fontSize: 12,\n            bold: true,\n            margin: [12, 2, 12, 2]\n        },\n        subheader: {\n            fontSize: 12,\n            bold: true,\n            margin: [12, 2, 12, 2]\n        },\n        tableExample: {\n            fontSize: 10,\n            bold: false,\n        },\n        tableExample1: {\n            fontSize: 12,\n            bold: false,\n        },\n        tableHeader: {\n            bold: true,\n            fontSize: 12,\n            color: 'red'\n        }\n    },\n    defaultStyle: {\n        // alignment: 'justify'\n    }\n\n    };\n\n    msg.payload = tableData;\n    return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1370,"y":2940,"wires":[["10877941b3d7e2ae"]]},{"id":"10877941b3d7e2ae","type":"pdfmake","z":"400bc99efba52b23","name":"","outputType":"Buffer","inputProperty":"payload","options":"{}","outputProperty":"payload","x":1530,"y":2940,"wires":[["27d8dd0654af7c15"]]}]

my flow uses several mysql queries (25 of them!) so i use a join node with a 'key' to merge the data.
so i have modified your datasample object to have a key.
if you can share your flow along with mysql query node,i can try replicate for you.

flows.json (4.9 KB)

1 Like

Some editors can corrupt code, and make it unreadable. Besides, it is far easier for all involved in trying to help you if code is posted using the correct method...

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

   code goes here 

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

[
    {
        "id": "fa2591a9667030c8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "27f1acd293046d97",
        "type": "ui_form",
        "z": "fa2591a9667030c8",
        "name": "",
        "label": "",
        "group": "126d3db65e2e2039",
        "order": 1,
        "width": 6,
        "height": 1,
        "options": [
            {
                "label": "From",
                "value": "From",
                "type": "date",
                "required": true,
                "rows": null
            },
            {
                "label": "To",
                "value": "To",
                "type": "date",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "From": "",
            "To": ""
        },
        "payload": "",
        "submit": "Generate Report",
        "cancel": "cancel",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": "",
        "className": "",
        "x": 90,
        "y": 200,
        "wires": [
            [
                "c01d7363ddc681bc"
            ]
        ]
    },
    {
        "id": "c01d7363ddc681bc",
        "type": "function",
        "z": "fa2591a9667030c8",
        "name": "Select",
        "func": "var fromdate = msg.payload.From;\nvar todate = msg.payload.To;\nmsg.topic = \"SELECT * FROM `node-red`.`final` where Date_Time between '\" + fromdate + \"' And '\" + todate + \"';\";\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 270,
        "y": 200,
        "wires": [
            [
                "afb712c20548bace"
            ]
        ]
    },
    {
        "id": "afb712c20548bace",
        "type": "mysql",
        "z": "fa2591a9667030c8",
        "mydb": "4290109d50355584",
        "name": "",
        "x": 440,
        "y": 200,
        "wires": [
            [
                "f1f733040cac9f7f"
            ]
        ]
    },
    {
        "id": "f1f733040cac9f7f",
        "type": "function",
        "z": "fa2591a9667030c8",
        "name": "function 35",
        "func": "let payload = {\ncontent: [\n\n    {\n        pageSize: 'A4',\n        pageOrientation: 'portrait',\n        text: 'Confined Area Monitoring Report:', fontSize: 14, bold: true, margin: [0, 20, 0, 8]\n    },\n    {\n        style: 'tableExample',\n\n        table: {\n            body: [\n                Object.keys(msg.payload[0]).map(key => { return { text: key, style: 'tableHeader' } })\n            ]\n        },\n\n        layout: 'lightHorizontalLines'\n    },\n\n],\n    styles: {\n    header: {\n        fontSize: 18,\n            bold: true,\n                margin: [0, 10, 0, 10]\n    },\n    subheader: {\n        fontSize: 16,\n            bold: true,\n                margin: [0, 10, 0, 5]\n    },\n    tableExample: {\n        margin: [0, 5, 0, 15]\n    },\n    tableHeader: {\n        bold: true,\n            fontSize: 13,\n                color: 'black'\n    }\n},\ndefaultStyle: {\n    // alignment: 'justify'\n\n}\n};\nObject.values(msg.payload).forEach(obj => {\n    payload.content[1].table.body.push(Object.values(obj));\n})\n\nmsg.payload = payload;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 630,
        "y": 200,
        "wires": [
            [
                "bc4fc784fdb62510"
            ]
        ]
    },
    {
        "id": "bc4fc784fdb62510",
        "type": "pdfmake",
        "z": "fa2591a9667030c8",
        "name": "",
        "outputType": "Buffer",
        "inputProperty": "payload",
        "options": "{}",
        "outputProperty": "payload",
        "x": 820,
        "y": 200,
        "wires": [
            [
                "f1b3678b4923f323"
            ]
        ]
    },
    {
        "id": "f1b3678b4923f323",
        "type": "file",
        "z": "fa2591a9667030c8",
        "name": "",
        "filename": "C:\\temp\\test.pdf",
        "filenameType": "str",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 1100,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "126d3db65e2e2039",
        "type": "ui_group",
        "name": "Generate Report",
        "tab": "78f8e318a5983d02",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "4290109d50355584",
        "type": "MySQLdatabase",
        "name": "",
        "host": "127.0.0.1",
        "port": "3306",
        "db": "node-red",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "78f8e318a5983d02",
        "type": "ui_tab",
        "name": "Report",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

yes, somehow the date component is not appearing in pdf if you use as it is.
i modified the query to remove * and actually put all the fields in the syntax with date field as below. i am not sure of your field names, i am guessing from your previous post, try this and see if it solves the issue.

below adaptation is working for me in my database.

msg.topic = "SELECT date_format(date_time,'%Y-%m-%d %h:%i'),CO,OX,Lux,Temp FROM `node-red`.`final` where Date_Time between '" + fromdate + "' And '" + todate + "';";

image

Many Many Thanks smanjunath211.its workig.

1 Like

can we change header of time stamp.In place of date_format(date_time,'%Y-%m-%d %h:%i') i want to use DateTime only.

use alias column name in the mysql query

msg.topic = "SELECT date_format(date_time,'%Y-%m-%d %h:%i') as 'Date_time', CO,OX,Lux,Temp FROM `node-red`.`final` where Date_Time between '" + fromdate + "' And '" + todate + "';";
1 Like

Great,its working.Many many thanks for your support.

1 Like