Dynamic loading of partials or self-contained modules

Hi, Ive been going round in circles on this for about a week and every AI agent claims it can do it but fails.

I want to create a dynamic report creator so that a user can decide out of all the 50+ reporting sections (summary, graph of x, graph of y, table, reference, glossary, introduction etc) that can be included in a report which ones they want and in which order. this is saved in mysql tables where one maps the reportid to all the sections the user wanted and the order in which they are placed. This is all working perfectly.

But how can i when a user says they want to create a report with id 9000 how does it then pull all the sections (details in other tables) into a long report that is executed and can be pdfd by using puppeteer etc.

One option is to have a long report with conditional partials for all those available that is turned on or off based on the table but this is a huge overhead where a page with 50 sections in the DOM with only say 3 being presented.

AI have gone round in circles trying to use wappler to do this but it doesnt seem possible and they’ve gone off to try and create a non-wappler environment to do this by adding a customReport module to extentions/server_connect/ROutes/xxx - loads of challenges couldnt get working and the reason i m using wappler is that im not an expert and want to use wappler’s capabilities to maintain, protect and extend this in the future.

Cant use partials because they are included at build time and I cant see other options to basically do a “ repeat - get the sections needed in order” then “include each section” .

Any human thoughts greatly appreciated… this is driving me nuts.

Thanks

Nigel

I would have the result in a normal HTML document - maybe hidden from the user - to then use the HTML2PDF extension to create the PDF. Streaming the PDF can be done by using the PDFStreamer

Thanks Ben i have the pdf generation already sorted for the pre-built reports but struggling with how to create the dynamic report/html in the first place… I am trying yet another AI who….. guess what is 100% confident, says I’m amazing and that i’ve done all the hard bits… will continue with this but already expect to be disappointed!!