Assume you have a sporting event or competition. Most likely the results will be stored in a database and have to be listed on a website. You can use the Fetch Api to fetch the data from the backend. This will not be explained in this document. I assume the data has already been retrieved and is an array of records.
Most sections are just html tables or html flex items.
In case you want to implement a running counter, you have to initialize/reset it in the right place. It can be achieved by putting some code in the relevant header:
If you only want to initialize objWork.runningCounter at the beginning of the report you can achieve that by putting the right code in reportDefinition.headers[0]. I call it property runningCounter, but you can give it any name you want.
You have to increase the running counter somewhere in your code because... otherwise it is not running ;-) for example:
Below source code I created to make this all work. It is kind of wrapper function for all headers and footers. Feel free to copy paste it and use it in your own module.
objWork is a javascript object that is passed as the second argument to createOutput function (optional argument, default {}). It is passed on as shallow copy to headers functions, footers functions, compare function, init function, source function and display function. All these functions share this object. You can use it for example for configuration information or color theme. objWork is automagically extended with { rawData: thisData }. For example createOutput(reportDefinition, { font: 'Arial', font_color: 'blue' }).