[{"data":1,"prerenderedAt":377},["ShallowReactive",2],{"blueprint-\u002Fblueprints\u002Fmanufacturing\u002Fpdf-report-generator":3},{"id":4,"title":5,"author":6,"blueprintId":7,"body":8,"description":364,"extension":365,"image":366,"meta":367,"navigation":368,"path":369,"seo":370,"stem":371,"tags":372,"updated":375,"__hash__":376},"blueprints\u002Fblueprints\u002Fmanufacturing\u002Fpdf-report-generator.md","PDF Report Generator",null,"lwkL6W0nDB",{"type":9,"value":10,"toc":355},"minimark",[11,15,20,25,28,35,39,51,54,59,63,66,69,73,81,84,100,103,228,259,344,348,351],[12,13,14],"p",{},"This Blueprint provides a means of generating PDF reports from a database.  It comes complete with a sample OEE database and a dashboard for selecting the facility, date and shift to build an OEE Shift Report.",[16,17,19],"h2",{"id":18},"getting-started-with-blueprint","Getting Started with Blueprint",[21,22,24],"h3",{"id":23},"prerequisites","Prerequisites",[12,26,27],{},"Before moving forward, ensure you have the following prepared:",[29,30,31],"ul",{},[32,33,34],"li",{},"A FlowFuse account with the Starter, Team, or Enterprise tier.",[21,36,38],{"id":37},"setting-up-the-blueprint","Setting Up the Blueprint",[40,41,42,45,48],"ol",{},[32,43,44],{},"To get started with the blueprint, click the \"Start\" button at the bottom. This will redirect you to the FlowFuse platform instance creation interface with the blueprint pre-selected.",[32,46,47],{},"Select the appropriate settings based on your preferences, such as instance type, application, and Node-RED version.",[32,49,50],{},"Click the “Create Instance” button.",[12,52,53],{},"Once the instance is successfully created, you can:",[29,55,56],{},[32,57,58],{},"Click the “Open Editor” button in the top-right corner to navigate to the Node-RED Editor.",[21,60,62],{"id":61},"testing-the-blueprint-with-simulated-data","Testing the Blueprint with Simulated Data",[12,64,65],{},"To test and explore the blueprint, sample data will be automatically generated in the \"Database\" tab of the flows.",[12,67,68],{},"Additionally, a dashboard has been included which is driven by the database and presents a set of fields for you to select a shift and generate a PDF report on the fly.",[21,70,72],{"id":71},"setting-up-the-blueprint-in-the-real-world","Setting Up the Blueprint in the Real World",[12,74,75,76,80],{},"To use this blueprint with your own data, where necessary, replace the ",[77,78,79],"strong",{},"SQLite"," nodes with the database nodes suited to your data source.",[12,82,83],{},"To adapt the queries to your database structure:",[40,85,86,89,92],{},[32,87,88],{},"If your field names are different, edit the SQLite nodes and change the source field names in the queries (do not change the alias names as they define the structure of the returned data and its properties).",[32,90,91],{},"If your table names are different, edit the SQLite nodes and change the table names and if necessary use an alias.",[32,93,94,95,99],{},"Do not change the parameters that start with ",[96,97,98],"code",{},"$",", as they are used for dynamic values in the query.",[12,101,102],{},"For example: we have following query to retrieve the production data:",[104,105,110],"pre",{"className":106,"code":107,"language":108,"meta":109,"style":109},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","SELECT\n    pd.id as id,\n    pd.planned_runtime_minutes as planned_runtime_minutes,\n    pd.runtime_minutes as runtime_minutes,\n    pd.shift_date as shift_date,\n    pd.planned_downtime_seconds as planned_downtime_seconds,\n    pd.unplanned_downtime_seconds as unplanned_downtime_seconds,\n    pd.total_units as total_units,\n    pd.good_units as good_units,\n    pd.scrap_units as scrap_units,\n    pd.availability as availability,\n    pd.performance as performance,\n    pd.quality as quality,\n    pd.oee_score as oee_score\nFROM\n    ProductionData pd\nWHERE\n    pd.facility_id = $facility_id\n    AND pd.planned_shift_id = $shift_id;\n","sql","",[96,111,112,120,126,132,138,144,150,156,162,168,174,180,186,192,198,204,210,216,222],{"__ignoreMap":109},[113,114,117],"span",{"class":115,"line":116},"line",1,[113,118,119],{},"SELECT\n",[113,121,123],{"class":115,"line":122},2,[113,124,125],{},"    pd.id as id,\n",[113,127,129],{"class":115,"line":128},3,[113,130,131],{},"    pd.planned_runtime_minutes as planned_runtime_minutes,\n",[113,133,135],{"class":115,"line":134},4,[113,136,137],{},"    pd.runtime_minutes as runtime_minutes,\n",[113,139,141],{"class":115,"line":140},5,[113,142,143],{},"    pd.shift_date as shift_date,\n",[113,145,147],{"class":115,"line":146},6,[113,148,149],{},"    pd.planned_downtime_seconds as planned_downtime_seconds,\n",[113,151,153],{"class":115,"line":152},7,[113,154,155],{},"    pd.unplanned_downtime_seconds as unplanned_downtime_seconds,\n",[113,157,159],{"class":115,"line":158},8,[113,160,161],{},"    pd.total_units as total_units,\n",[113,163,165],{"class":115,"line":164},9,[113,166,167],{},"    pd.good_units as good_units,\n",[113,169,171],{"class":115,"line":170},10,[113,172,173],{},"    pd.scrap_units as scrap_units,\n",[113,175,177],{"class":115,"line":176},11,[113,178,179],{},"    pd.availability as availability,\n",[113,181,183],{"class":115,"line":182},12,[113,184,185],{},"    pd.performance as performance,\n",[113,187,189],{"class":115,"line":188},13,[113,190,191],{},"    pd.quality as quality,\n",[113,193,195],{"class":115,"line":194},14,[113,196,197],{},"    pd.oee_score as oee_score\n",[113,199,201],{"class":115,"line":200},15,[113,202,203],{},"FROM\n",[113,205,207],{"class":115,"line":206},16,[113,208,209],{},"    ProductionData pd\n",[113,211,213],{"class":115,"line":212},17,[113,214,215],{},"WHERE\n",[113,217,219],{"class":115,"line":218},18,[113,220,221],{},"    pd.facility_id = $facility_id\n",[113,223,225],{"class":115,"line":224},19,[113,226,227],{},"    AND pd.planned_shift_id = $shift_id;\n",[12,229,230,231,234,235,238,239,234,242,245,246,234,249,245,252,234,255,258],{},"If your database table is named ",[96,232,233],{},"perf_data"," instead of ",[96,236,237],{},"ProductionData"," and it uses different field names, such as ",[96,240,241],{},"runtime",[96,243,244],{},"planned_runtime_minutes",", ",[96,247,248],{},"shift_ident",[96,250,251],{},"planned_shift_id",[96,253,254],{},"machine",[96,256,257],{},"facility_id",", you should update the query field names to suit.\nAfter modification, it should look like this:",[104,260,262],{"className":106,"code":261,"language":108,"meta":109,"style":109},"SELECT\n    pd.id as id,\n    pd.runtime as planned_runtime_minutes,  -- updated field name\n    pd.runtime_minutes as runtime_minutes,\n    pd.shift_date as shift_date,\n    pd.planned_downtime_seconds as planned_downtime_seconds,\n    pd.unplanned_downtime_seconds as unplanned_downtime_seconds,\n    pd.total_units as total_units,\n    pd.good_units as good_units,\n    pd.scrap_units as scrap_units,\n    pd.availability as availability,\n    pd.performance as performance,\n    pd.quality as quality,\n    pd.oee_score as oee_score\nFROM\n    perf_data pd -- updated table name\nWHERE\n    pd.machine = $facility_id  -- updated field name\n    AND pd.shift_ident = $shift_id;  -- updated field name\n",[96,263,264,268,272,277,281,285,289,293,297,301,305,309,313,317,321,325,330,334,339],{"__ignoreMap":109},[113,265,266],{"class":115,"line":116},[113,267,119],{},[113,269,270],{"class":115,"line":122},[113,271,125],{},[113,273,274],{"class":115,"line":128},[113,275,276],{},"    pd.runtime as planned_runtime_minutes,  -- updated field name\n",[113,278,279],{"class":115,"line":134},[113,280,137],{},[113,282,283],{"class":115,"line":140},[113,284,143],{},[113,286,287],{"class":115,"line":146},[113,288,149],{},[113,290,291],{"class":115,"line":152},[113,292,155],{},[113,294,295],{"class":115,"line":158},[113,296,161],{},[113,298,299],{"class":115,"line":164},[113,300,167],{},[113,302,303],{"class":115,"line":170},[113,304,173],{},[113,306,307],{"class":115,"line":176},[113,308,179],{},[113,310,311],{"class":115,"line":182},[113,312,185],{},[113,314,315],{"class":115,"line":188},[113,316,191],{},[113,318,319],{"class":115,"line":194},[113,320,197],{},[113,322,323],{"class":115,"line":200},[113,324,203],{},[113,326,327],{"class":115,"line":206},[113,328,329],{},"    perf_data pd -- updated table name\n",[113,331,332],{"class":115,"line":212},[113,333,215],{},[113,335,336],{"class":115,"line":218},[113,337,338],{},"    pd.machine = $facility_id  -- updated field name\n",[113,340,341],{"class":115,"line":224},[113,342,343],{},"    AND pd.shift_ident = $shift_id;  -- updated field name\n",[16,345,347],{"id":346},"conclusion","Conclusion",[12,349,350],{},"This Blueprint provides a basis for how to get your data from a database and compile a PDF report from its tables in a low code manner.",[352,353,354],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":109,"searchDepth":134,"depth":134,"links":356},[357,363],{"id":18,"depth":122,"text":19,"children":358},[359,360,361,362],{"id":23,"depth":128,"text":24},{"id":37,"depth":128,"text":38},{"id":61,"depth":128,"text":62},{"id":71,"depth":128,"text":72},{"id":346,"depth":122,"text":347},"Build PDF reports from your data.","md","\u002Fblueprints\u002Fmanufacturing\u002Fpdf-report-generator\u002Foee-shift-report.png",{},true,"\u002Fblueprints\u002Fmanufacturing\u002Fpdf-report-generator",{"title":5,"description":364},"blueprints\u002Fmanufacturing\u002Fpdf-report-generator",[373,374],"blueprints","manufacturing","2025-04-29 15:26:10 +0100","pqrevbpaf7walW-9zpIF8QOS0O0zO-2MZg3KCwFMxYo",1789897189223]