Possible to automatically add/remove table rows based data?
Quick background: I have a data collection app where the user fills out information, and within jsreport I need to create a table using information that the user collects (I'm bringing the data from my app into jsreport in JSON format). For the sake of keeping things simple, say I have 10 fields within my app that I want to use to populate a table in a report template. However, not all 10 fields will contain data and I only want to populate the table with a field ONLY if it contains data (this will prevent the table from being mostly blank rows in the event there's only 1 piece of information that will need to populate it). If there's only 1 field that contains data out of that 10, then I want the table to have 1 row. If there's 2 pieces of data, then I want the table to have 2 rows... etc.
Is it possible in jsreport to programatically create a table of "x" rows based on the data that is brought in? And how would that HTML look in the actual report template itself?
I can't seem to find the answer to this anywhere, but if it exists I would be greatly appreciative if you could point me in the right direction. Thank you in advance for any help!
It seems to me this is a common job you do with templating engines.
In jsreport, templating engines like handlebars are used to dynamically assemble the html.
If you are new here, I recommend check some basic examples
Our docs to handlebars
And when you need to go deeper, check the handlebars official docs and google out handlebars examples