Done! successfuly generated pdf with the new flow
[{"id":"ec11c4c479035a8b","type":"group","z":"37ef9ab5d60ffd43","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["e7acbd52452fd432","b682b9984edb4eeb","1f3a0c4b25900303","3b65129d5fc39fba","19f1d07d833c4089","b2d12f4267a996af","cbb706cb5d296bde","351f4a478470d01a","5a0e6d1cd6577bbf","a14e0509d666af81","1aace55de5fe6514","82f86fcf50667ffb","c2841fd1eca9125a","b7d5e5bb0c82fbd7"],"x":154,"y":2599,"w":1302,"h":322},{"id":"e7acbd52452fd432","type":"change","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"PRODUCTION REPORT (OLD)","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"querys1\":[{\"Shift\":\"08-A\",\"CR3\":1970,\"MSP1\":0,\"BTP1\":0,\"SP4\":2116,\"SP3\":4579,\"PFSL\":1736,\"PFSR\":1643,\"CR1\":1490,\"JUC\":77226,\"CFT\":0,\"14T\":0,\"12T\":3,\"BTP3\":42051,\"DIP\":850,\"BTP2\":41515,\"SP5\":3727,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Shift\":\"08-B\",\"CR3\":1879,\"MSP1\":0,\"BTP1\":0,\"SP4\":2557,\"SP3\":2740,\"PFSL\":331,\"PFSR\":260,\"CR1\":4102,\"JUC\":101871,\"CFT\":0,\"14T\":0,\"12T\":2,\"BTP3\":45946,\"DIP\":2690,\"BTP2\":48042,\"SP5\":2414,\"AP2\":0,\"MSP2\":22,\"BAGR\":0},{\"Shift\":\"08-C\",\"CR3\":2354,\"MSP1\":0,\"BTP1\":0,\"SP4\":2208,\"SP3\":2209,\"PFSL\":4015,\"PFSR\":3689,\"CR1\":0,\"JUC\":100130,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":47434,\"DIP\":3766,\"BTP2\":48206,\"SP5\":1944,\"AP2\":0,\"MSP2\":53,\"BAGR\":0},{\"Shift\":\"08-Day\",\"CR3\":6203,\"MSP1\":0,\"BTP1\":0,\"SP4\":6881,\"SP3\":9528,\"PFSL\":6082,\"PFSR\":5592,\"CR1\":5592,\"JUC\":279227,\"CFT\":0,\"14T\":0,\"12T\":5,\"BTP3\":135431,\"DIP\":7306,\"BTP2\":137763,\"SP5\":8085,\"AP2\":0,\"MSP2\":75,\"BAGR\":0}],\"querys3\":[{\"Hour\":\"14-15\",\"CR3\":239,\"MSP1\":0,\"BTP\":0,\"SP4\":6,\"SP3\":728,\"PFSL\":0,\"PFSR\":0,\"CR1\":1005,\"JUC\":8599,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":4679,\"DIP\":0,\"BTP2\":4911,\"SP5\":12,\"AP2\":0,\"MSP2\":1,\"BAGR\":0},{\"Hour\":\"15-16\",\"CR3\":343,\"MSP1\":0,\"BTP\":0,\"SP4\":96,\"SP3\":883,\"PFSL\":0,\"PFSR\":0,\"CR1\":955,\"JUC\":13770,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6599,\"DIP\":675,\"BTP2\":6599,\"SP5\":971,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"16-17\",\"CR3\":343,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":300,\"PFSL\":0,\"PFSR\":0,\"CR1\":664,\"JUC\":14399,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":4010,\"DIP\":767,\"BTP2\":5962,\"SP5\":239,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"17-18\",\"CR3\":343,\"MSP1\":0,\"BTP\":0,\"SP4\":244,\"SP3\":732,\"PFSL\":0,\"PFSR\":0,\"CR1\":698,\"JUC\":13100,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6347,\"DIP\":1043,\"BTP2\":6371,\"SP5\":794,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"18-19\",\"CR3\":13,\"MSP1\":0,\"BTP\":0,\"SP4\":1101,\"SP3\":97,\"PFSL\":0,\"PFSR\":0,\"CR1\":369,\"JUC\":14323,\"CFT\":0,\"14T\":0,\"12T\":2,\"BTP3\":5824,\"DIP\":203,\"BTP2\":5886,\"SP5\":398,\"AP2\":0,\"MSP2\":5,\"BAGR\":0},{\"Hour\":\"19-20\",\"CR3\":0,\"MSP1\":0,\"BTP\":0,\"SP4\":683,\"SP3\":0,\"PFSL\":14,\"PFSR\":12,\"CR1\":391,\"JUC\":13433,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6599,\"DIP\":0,\"BTP2\":6383,\"SP5\":0,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"20-21\",\"CR3\":266,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":0,\"PFSL\":0,\"PFSR\":0,\"CR1\":0,\"JUC\":10969,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":5701,\"DIP\":0,\"BTP2\":5822,\"SP5\":0,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"21-22\",\"CR3\":332,\"MSP1\":0,\"BTP\":0,\"SP4\":427,\"SP3\":0,\"PFSL\":317,\"PFSR\":248,\"CR1\":1,\"JUC\":13258,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6247,\"DIP\":0,\"BTP2\":6218,\"SP5\":0,\"AP2\":0,\"MSP2\":16,\"BAGR\":0},{\"Hour\":\"08--B\",\"CR3\":1879,\"MSP1\":0,\"BTP\":0,\"SP4\":2557,\"SP3\":2740,\"PFSL\":331,\"PFSR\":260,\"CR1\":4083,\"JUC\":101851,\"CFT\":0,\"14T\":0,\"12T\":2,\"BTP3\":46006,\"DIP\":2688,\"BTP2\":48152,\"SP5\":2414,\"AP2\":0,\"MSP2\":22,\"BAGR\":0}],\"querys2\":[{\"Hour\":\"06-07\",\"CR3\":0,\"MSP1\":0,\"BTP\":0,\"SP4\":537,\"SP3\":519,\"PFSL\":147,\"PFSR\":121,\"CR1\":7,\"JUC\":0,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":1922,\"DIP\":103,\"BTP2\":1347,\"SP5\":158,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"07-08\",\"CR3\":93,\"MSP1\":0,\"BTP\":0,\"SP4\":459,\"SP3\":982,\"PFSL\":631,\"PFSR\":625,\"CR1\":0,\"JUC\":5914,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6599,\"DIP\":206,\"BTP2\":4589,\"SP5\":672,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"08-09\",\"CR3\":280,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":46,\"PFSL\":0,\"PFSR\":0,\"CR1\":0,\"JUC\":10219,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6541,\"DIP\":342,\"BTP2\":6588,\"SP5\":0,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"09-10\",\"CR3\":335,\"MSP1\":0,\"BTP\":0,\"SP4\":1039,\"SP3\":1020,\"PFSL\":799,\"PFSR\":771,\"CR1\":323,\"JUC\":11929,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6261,\"DIP\":0,\"BTP2\":6599,\"SP5\":672,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"10-11\",\"CR3\":337,\"MSP1\":0,\"BTP\":0,\"SP4\":81,\"SP3\":142,\"PFSL\":159,\"PFSR\":126,\"CR1\":522,\"JUC\":9746,\"CFT\":0,\"14T\":0,\"12T\":1,\"BTP3\":5208,\"DIP\":0,\"BTP2\":6599,\"SP5\":786,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"11-12\",\"CR3\":332,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":900,\"PFSL\":0,\"PFSR\":0,\"CR1\":46,\"JUC\":14931,\"CFT\":0,\"14T\":0,\"12T\":2,\"BTP3\":5241,\"DIP\":4,\"BTP2\":5476,\"SP5\":715,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"12-13\",\"CR3\":343,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":676,\"PFSL\":0,\"PFSR\":0,\"CR1\":171,\"JUC\":15173,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6313,\"DIP\":104,\"BTP2\":6589,\"SP5\":670,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"13-14\",\"CR3\":256,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":294,\"PFSL\":0,\"PFSR\":0,\"CR1\":440,\"JUC\":9584,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":3966,\"DIP\":93,\"BTP2\":3728,\"SP5\":54,\"AP2\":0,\"MSP2\":0,\"BAGR\":0},{\"Hour\":\"08--A\",\"CR3\":1976,\"MSP1\":0,\"BTP\":0,\"SP4\":2116,\"SP3\":4579,\"PFSL\":1736,\"PFSR\":1643,\"CR1\":1509,\"JUC\":77496,\"CFT\":0,\"14T\":0,\"12T\":3,\"BTP3\":42051,\"DIP\":852,\"BTP2\":41515,\"SP5\":3727,\"AP2\":0,\"MSP2\":0,\"BAGR\":0}],\"querys4\":[{\"Hour\":\"22-23\",\"CR3\":332,\"MSP1\":0,\"BTP\":0,\"SP4\":1010,\"SP3\":21,\"PFSL\":414,\"PFSR\":354,\"CR1\":0,\"JUC\":13207,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":3523,\"DIP\":0,\"BTP2\":4867,\"SP5\":0,\"AP2\":0,\"MSP2\":6,\"BAGR\":0},{\"Hour\":\"23-00\",\"CR3\":226,\"MSP1\":0,\"BTP\":0,\"SP4\":453,\"SP3\":0,\"PFSL\":920,\"PFSR\":831,\"CR1\":0,\"JUC\":14864,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6489,\"DIP\":0,\"BTP2\":6489,\"SP5\":0,\"AP2\":0,\"MSP2\":1,\"BAGR\":0},{\"Hour\":\"00-01\",\"CR3\":356,\"MSP1\":0,\"BTP\":0,\"SP4\":175,\"SP3\":6,\"PFSL\":113,\"PFSR\":124,\"CR1\":0,\"JUC\":14538,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":5812,\"DIP\":0,\"BTP2\":5794,\"SP5\":0,\"AP2\":0,\"MSP2\":5,\"BAGR\":0},{\"Hour\":\"01-02\",\"CR3\":330,\"MSP1\":0,\"BTP\":0,\"SP4\":467,\"SP3\":284,\"PFSL\":733,\"PFSR\":692,\"CR1\":0,\"JUC\":10407,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6593,\"DIP\":15,\"BTP2\":5661,\"SP5\":6,\"AP2\":0,\"MSP2\":17,\"BAGR\":0},{\"Hour\":\"02-03\",\"CR3\":254,\"MSP1\":0,\"BTP\":0,\"SP4\":96,\"SP3\":493,\"PFSL\":960,\"PFSR\":870,\"CR1\":0,\"JUC\":10168,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":5699,\"DIP\":994,\"BTP2\":6599,\"SP5\":815,\"AP2\":0,\"MSP2\":6,\"BAGR\":0},{\"Hour\":\"03-04\",\"CR3\":357,\"MSP1\":0,\"BTP\":0,\"SP4\":7,\"SP3\":0,\"PFSL\":18,\"PFSR\":15,\"CR1\":0,\"JUC\":14047,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6599,\"DIP\":1178,\"BTP2\":6599,\"SP5\":0,\"AP2\":0,\"MSP2\":4,\"BAGR\":0},{\"Hour\":\"04-05\",\"CR3\":195,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":469,\"PFSL\":339,\"PFSR\":316,\"CR1\":0,\"JUC\":10545,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6599,\"DIP\":732,\"BTP2\":6308,\"SP5\":633,\"AP2\":0,\"MSP2\":9,\"BAGR\":0},{\"Hour\":\"05-06\",\"CR3\":298,\"MSP1\":0,\"BTP\":0,\"SP4\":0,\"SP3\":936,\"PFSL\":518,\"PFSR\":487,\"CR1\":0,\"JUC\":12104,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":6060,\"DIP\":847,\"BTP2\":5779,\"SP5\":490,\"AP2\":0,\"MSP2\":5,\"BAGR\":0},{\"Hour\":\"08--C\",\"CR3\":2354,\"MSP1\":0,\"BTP\":0,\"SP4\":2208,\"SP3\":2209,\"PFSL\":4015,\"PFSR\":3689,\"CR1\":0,\"JUC\":100130,\"CFT\":0,\"14T\":0,\"12T\":0,\"BTP3\":47434,\"DIP\":3766,\"BTP2\":48206,\"SP5\":1944,\"AP2\":0,\"MSP2\":53,\"BAGR\":0}]}","tot":"json"},{"t":"set","p":"pdf_header1","pt":"flow","to":"Report from Old Method","tot":"str"},{"t":"set","p":"shifta","pt":"flow","to":"SHIFT-A","tot":"str"},{"t":"set","p":"shiftb","pt":"flow","to":"SHIFT-B","tot":"str"},{"t":"set","p":"shiftc","pt":"flow","to":"SHIFT-C","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":2820,"wires":[["1f3a0c4b25900303","3b65129d5fc39fba"]]},{"id":"b682b9984edb4eeb","type":"inject","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"Load","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":2820,"wires":[["e7acbd52452fd432","19f1d07d833c4089"]]},{"id":"1f3a0c4b25900303","type":"function","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"data to pdf","func":"///\nlet querys1Data = []\nmsg.payload.querys1.forEach(obj => { querys1Data.push(Object.entries(obj).map(([key, value]) => { return !isNaN(value) ? { text: value, alignment: 'right' } : { text: value, bold: true, alignment: 'left' } })) })\nlet querys2Data = []\nmsg.payload.querys2.forEach(obj => { querys2Data.push(Object.entries(obj).map(([key, value]) => { return !isNaN(value) ? { text: value, alignment: 'right' } : { text: value, bold: true,alignment: 'left' } })) })\nlet querys3Data = []\nmsg.payload.querys3.forEach(obj => { querys3Data.push(Object.entries(obj).map(([key, value]) => { return !isNaN(value) ? { text: value, alignment: 'right' } : { text: value, bold: true,alignment: 'left' } })) })\nlet querys4Data = []\nmsg.payload.querys4.forEach(obj => { querys4Data.push(Object.entries(obj).map(([key, value]) => { return !isNaN(value) ? { text: value, alignment: 'right' } : { text: value, bold: true,alignment: 'left' } })) })\n\n///\n\nlet tableData = {\n\n // pageSize: 'a3',\n pageSize: { width: 1100, height: 'auto' }, pageOrientation: 'portrait',\n\n content: [\n { text: flow.get(\"pdf_header1\"), 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(\"production_header\"), fontSize: 14, bold: true, margin: [12, 5, 12, 5] }, \n {\n style: 'tableExample',\n table: {\n headerRows: 1,\n// widths: [40, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35],\n body: [\n Object.keys(msg.payload.querys1[0]).map(key => { return { text: key, alignment: key.startsWith(\"Shift\") ? \"left\" : \"right\", style: 'tableHeader' } }),\n ...querys1Data\n ]\n },\n layout: 'lightHorizontalLines'\n },\n {text: '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------', \nfontSize: 10, bold: false, color: 'orange', margin: [0, 0, 0, 5] },\n\n { text: flow.get(\"shifta\"), fontSize: 14, bold: true, margin: [12, 5, 12, 5] },\n \n {\n style: 'tableExample',\n table: {\n headerRows: 1,\n// widths: [40, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35],\n body: [\n Object.keys(msg.payload.querys2[0]).map(key => { return { text: key, alignment: key.startsWith(\"Hour\") ? \"left\" : \"right\", style: 'tableHeader' } }),\n ...querys2Data\n ]\n },\n layout: 'lightHorizontalLines'\n },\n\n { text: flow.get(\"shiftb\"), fontSize: 14, bold: true, margin: [12, 5, 12, 5] },\n \n {\n style: 'tableExample',\n table: {\n headerRows: 1,\n// widths: [40, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35],\n body: [\n Object.keys(msg.payload.querys3[0]).map(key => { return { text: key, alignment: key.startsWith(\"Hour\") ? \"left\" : \"right\",style: 'tableHeader' } }),\n ...querys3Data\n ]\n },\n layout: 'lightHorizontalLines'\n },\n\n { text: flow.get(\"shiftc\"), fontSize: 14, bold: true, margin: [12, 5, 12, 5] },\n \n {\n style: 'tableExample',\n table: {\n headerRows: 1,\n// widths: [40, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35],\n body: [\n Object.keys(msg.payload.querys4[0]).map(key => { return { text: key, alignment: key.startsWith(\"Hour\") ? \"left\" : \"right\",style: 'tableHeader' } }),\n ...querys4Data\n ]\n },\n layout: 'lightHorizontalLines'\n },\n\n \n \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 tableHeader: {\n bold: true,\n fontSize: 12,\n color: 'red'\n }\n },\n defaultStyle: {\n // alignment: 'justify'\n }\n\n};\n\nmsg.payload = tableData;\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":2760,"wires":[["cbb706cb5d296bde","351f4a478470d01a"]]},{"id":"3b65129d5fc39fba","type":"debug","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"Old","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":2820,"wires":[]},{"id":"19f1d07d833c4089","type":"debug","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"Old-Raw","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":330,"y":2880,"wires":[]},{"id":"b2d12f4267a996af","type":"change","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"PRODUCTION REPORT (NEW)","rules":[{"t":"set","p":"pdf_header1","pt":"flow","to":"Report from New Method","tot":"str"},{"t":"set","p":"shifta","pt":"flow","to":"SHIFT-1","tot":"str"},{"t":"set","p":"shiftb","pt":"flow","to":"SHIFT-2","tot":"str"},{"t":"set","p":"shiftc","pt":"flow","to":"SHIFT-3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":2700,"wires":[["1f3a0c4b25900303","a14e0509d666af81"]]},{"id":"cbb706cb5d296bde","type":"debug","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"Check","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1070,"y":2700,"wires":[]},{"id":"351f4a478470d01a","type":"pdfmake","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"","outputType":"Buffer","inputProperty":"payload","options":"{}","outputProperty":"payload","x":1120,"y":2760,"wires":[["1aace55de5fe6514"]]},{"id":"5a0e6d1cd6577bbf","type":"change","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"Lookup","rules":[{"t":"set","p":"lookup","pt":"msg","to":"{\"querys1\":[\"HA\",\"HB\",\"HC\",\"HD\"],\"querys2\":[\"H06\",\"H07\",\"H08\",\"H09\",\"H10\",\"H11\",\"H12\",\"H13\",\"HA\"],\"querys3\":[\"H14\",\"H15\",\"H16\",\"H17\",\"H18\",\"H19\",\"H20\",\"H21\",\"HB\"],\"querys4\":[\"H22\",\"H23\",\"H00\",\"H01\",\"H02\",\"H03\",\"H04\",\"H05\",\"HC\"]}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"$merge(\t $each($$.lookup, function($v,$k){\t {\t $k:[$v.$single($$.payload, function($vo,$io){\t $vo.datehour = $\t })]\t }\t })\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":2700,"wires":[["b2d12f4267a996af"]]},{"id":"a14e0509d666af81","type":"debug","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"New","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":870,"y":2680,"wires":[]},{"id":"1aace55de5fe6514","type":"change","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"","rules":[{"t":"set","p":"fn","pt":"flow","to":"c:\\temp\\prd.pdf","tot":"str"},{"t":"set","p":"fn","pt":"msg","to":"fn","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1300,"y":2760,"wires":[["c2841fd1eca9125a"]]},{"id":"82f86fcf50667ffb","type":"inject","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H06\",\"sum_m00\":0,\"sum_m01\":2,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":549,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":7578,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":55,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":378,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":12,\"sum_m20\":0,\"sum_m21\":0,\"sum_m22\":0,\"sum_m23\":0},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H07\",\"sum_m00\":0,\"sum_m01\":3,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":122,\"sum_m05\":330,\"sum_m06\":293,\"sum_m07\":0,\"sum_m08\":14366,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":1156,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1858,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":6,\"sum_m20\":0,\"sum_m21\":0,\"sum_m22\":0,\"sum_m23\":0},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H08\",\"sum_m00\":0,\"sum_m01\":2,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":110,\"sum_m06\":101,\"sum_m07\":0,\"sum_m08\":14277,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":1014,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1831,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":15,\"sum_m20\":0,\"sum_m21\":506,\"sum_m22\":432,\"sum_m23\":0},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H09\",\"sum_m00\":0,\"sum_m01\":27,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":1014,\"sum_m05\":456,\"sum_m06\":418,\"sum_m07\":0,\"sum_m08\":11719,\"sum_m09\":0,\"sum_m10\":2,\"sum_m11\":966,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":568,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":60,\"sum_m20\":0,\"sum_m21\":926,\"sum_m22\":955,\"sum_m23\":0},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H10\",\"sum_m00\":0,\"sum_m01\":2,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":508,\"sum_m05\":1118,\"sum_m06\":969,\"sum_m07\":0,\"sum_m08\":2102,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":1361,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":465,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":47,\"sum_m20\":0,\"sum_m21\":597,\"sum_m22\":458,\"sum_m23\":0},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H11\",\"sum_m00\":0,\"sum_m01\":76,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":509,\"sum_m05\":950,\"sum_m06\":838,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":502,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1850,\"sum_m17\":0,\"sum_m18\":5,\"sum_m19\":60,\"sum_m20\":0,\"sum_m21\":132,\"sum_m22\":107,\"sum_m23\":5},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H12\",\"sum_m00\":0,\"sum_m01\":402,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":510,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":1091,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1821,\"sum_m17\":0,\"sum_m18\":14,\"sum_m19\":53,\"sum_m20\":0,\"sum_m21\":106,\"sum_m22\":16,\"sum_m23\":633},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"H13\",\"sum_m00\":0,\"sum_m01\":943,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":551,\"sum_m06\":491,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":238,\"sum_m11\":1082,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1249,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":45,\"sum_m20\":0,\"sum_m21\":17,\"sum_m22\":0,\"sum_m23\":643},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H14\",\"sum_m00\":0,\"sum_m01\":1022,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":538,\"sum_m05\":402,\"sum_m06\":357,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":1137,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1681,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":35,\"sum_m20\":2,\"sum_m21\":0,\"sum_m22\":0,\"sum_m23\":573},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H15\",\"sum_m00\":0,\"sum_m01\":1598,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":636,\"sum_m05\":918,\"sum_m06\":787,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":870,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1751,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":51,\"sum_m20\":270,\"sum_m21\":36,\"sum_m22\":7,\"sum_m23\":67},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H16\",\"sum_m00\":0,\"sum_m01\":1545,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":7,\"sum_m06\":5,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":0,\"sum_m11\":104,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":2094,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":37,\"sum_m20\":297,\"sum_m21\":0,\"sum_m22\":0,\"sum_m23\":0},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H17\",\"sum_m00\":0,\"sum_m01\":890,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":522,\"sum_m06\":412,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":171,\"sum_m11\":356,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1574,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":60,\"sum_m20\":258,\"sum_m21\":621,\"sum_m22\":331,\"sum_m23\":138},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H18\",\"sum_m00\":0,\"sum_m01\":937,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":887,\"sum_m06\":702,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":180,\"sum_m11\":997,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1575,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":44,\"sum_m20\":0,\"sum_m21\":0,\"sum_m22\":140,\"sum_m23\":1112},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H19\",\"sum_m00\":0,\"sum_m01\":1736,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":1277,\"sum_m11\":1102,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1478,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":41,\"sum_m20\":435,\"sum_m21\":670,\"sum_m22\":1954,\"sum_m23\":1010},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H20\",\"sum_m00\":0,\"sum_m01\":1714,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":1729,\"sum_m11\":649,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1986,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":53,\"sum_m20\":350,\"sum_m21\":4317,\"sum_m22\":5046,\"sum_m23\":1109},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"H21\",\"sum_m00\":0,\"sum_m01\":1723,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":1251,\"sum_m11\":963,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1621,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":44,\"sum_m20\":358,\"sum_m21\":3176,\"sum_m22\":3587,\"sum_m23\":999},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H22\",\"sum_m00\":0,\"sum_m01\":853,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":527,\"sum_m11\":220,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1253,\"sum_m17\":0,\"sum_m18\":409,\"sum_m19\":60,\"sum_m20\":499,\"sum_m21\":5399,\"sum_m22\":5399,\"sum_m23\":1022},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H23\",\"sum_m00\":0,\"sum_m01\":933,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":115,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":664,\"sum_m11\":789,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1161,\"sum_m17\":0,\"sum_m18\":1096,\"sum_m19\":60,\"sum_m20\":304,\"sum_m21\":5400,\"sum_m22\":5399,\"sum_m23\":1176},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H00\",\"sum_m00\":0,\"sum_m01\":1647,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":709,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":66,\"sum_m09\":0,\"sum_m10\":940,\"sum_m11\":701,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1925,\"sum_m17\":0,\"sum_m18\":452,\"sum_m19\":57,\"sum_m20\":414,\"sum_m21\":4739,\"sum_m22\":4545,\"sum_m23\":1167},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H01\",\"sum_m00\":0,\"sum_m01\":1663,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":1352,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":1381,\"sum_m09\":0,\"sum_m10\":2908,\"sum_m11\":774,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":2094,\"sum_m17\":0,\"sum_m18\":952,\"sum_m19\":60,\"sum_m20\":80,\"sum_m21\":5399,\"sum_m22\":5399,\"sum_m23\":1043},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H02\",\"sum_m00\":0,\"sum_m01\":1573,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":1161,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":13067,\"sum_m09\":0,\"sum_m10\":3078,\"sum_m11\":1244,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1680,\"sum_m17\":0,\"sum_m18\":650,\"sum_m19\":59,\"sum_m20\":561,\"sum_m21\":5400,\"sum_m22\":5399,\"sum_m23\":1174},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H03\",\"sum_m00\":0,\"sum_m01\":439,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":0,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":12657,\"sum_m09\":0,\"sum_m10\":220,\"sum_m11\":55,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1244,\"sum_m17\":0,\"sum_m18\":519,\"sum_m19\":60,\"sum_m20\":0,\"sum_m21\":5399,\"sum_m22\":4977,\"sum_m23\":1171},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H04\",\"sum_m00\":0,\"sum_m01\":1459,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":992,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":12296,\"sum_m09\":0,\"sum_m10\":1665,\"sum_m11\":1100,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1652,\"sum_m17\":0,\"sum_m18\":928,\"sum_m19\":60,\"sum_m20\":447,\"sum_m21\":4765,\"sum_m22\":4645,\"sum_m23\":1152},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"H05\",\"sum_m00\":0,\"sum_m01\":1464,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":980,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":13769,\"sum_m09\":0,\"sum_m10\":1465,\"sum_m11\":871,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":1234,\"sum_m17\":0,\"sum_m18\":1189,\"sum_m19\":60,\"sum_m20\":464,\"sum_m21\":4507,\"sum_m22\":5177,\"sum_m23\":1094},{\"dateshift\":\"10-Jan-A\",\"datehour\":\"HA\",\"sum_m00\":0,\"sum_m01\":1457,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":3212,\"sum_m05\":3515,\"sum_m06\":3110,\"sum_m07\":0,\"sum_m08\":50042,\"sum_m09\":0,\"sum_m10\":240,\"sum_m11\":7227,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":10020,\"sum_m17\":0,\"sum_m18\":19,\"sum_m19\":298,\"sum_m20\":0,\"sum_m21\":2284,\"sum_m22\":1968,\"sum_m23\":1281},{\"dateshift\":\"10-Jan-B\",\"datehour\":\"HB\",\"sum_m00\":0,\"sum_m01\":11165,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":1174,\"sum_m05\":2736,\"sum_m06\":2263,\"sum_m07\":0,\"sum_m08\":0,\"sum_m09\":0,\"sum_m10\":4608,\"sum_m11\":6178,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":13760,\"sum_m17\":0,\"sum_m18\":0,\"sum_m19\":365,\"sum_m20\":1970,\"sum_m21\":8820,\"sum_m22\":11065,\"sum_m23\":5008},{\"dateshift\":\"10-Jan-C\",\"datehour\":\"HC\",\"sum_m00\":0,\"sum_m01\":10031,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":5309,\"sum_m05\":0,\"sum_m06\":0,\"sum_m07\":0,\"sum_m08\":53236,\"sum_m09\":0,\"sum_m10\":11467,\"sum_m11\":5754,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":12243,\"sum_m17\":0,\"sum_m18\":6195,\"sum_m19\":476,\"sum_m20\":2769,\"sum_m21\":41008,\"sum_m22\":40940,\"sum_m23\":8999},{\"dateshift\":\"10-Jan-Day\",\"datehour\":\"HD\",\"sum_m00\":0,\"sum_m01\":22653,\"sum_m02\":0,\"sum_m03\":0,\"sum_m04\":9695,\"sum_m05\":6251,\"sum_m06\":5373,\"sum_m07\":0,\"sum_m08\":103278,\"sum_m09\":0,\"sum_m10\":16315,\"sum_m11\":19159,\"sum_m12\":0,\"sum_m13\":0,\"sum_m14\":0,\"sum_m15\":0,\"sum_m16\":36023,\"sum_m17\":0,\"sum_m18\":6214,\"sum_m19\":1139,\"sum_m20\":4739,\"sum_m21\":52112,\"sum_m22\":53973,\"sum_m23\":15288}]","payloadType":"json","x":250,"y":2700,"wires":[["5a0e6d1cd6577bbf","b7d5e5bb0c82fbd7"]]},{"id":"c2841fd1eca9125a","type":"file","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"","filename":"fn","filenameType":"msg","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1415,"y":2760,"wires":[[]],"l":false},{"id":"b7d5e5bb0c82fbd7","type":"debug","z":"37ef9ab5d60ffd43","g":"ec11c4c479035a8b","name":"New-Raw","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":330,"y":2640,"wires":[]}]
Thanks @E1cid for the patient hearing and giving me a concise and effective solution.
although , the new report has many extra elements which i dont want in the report, column headers are not descriptive and also the widths of each column is not optimised, but thats for another topic. current problem at hand solved!
h