Middleware service in Report

As far as I could gather from the documentation the YARG reporting gives you the functionality to use entities (directly or by using JPA or SQL) - but in my instance I have a service that calculates current stock from various entities and I want to use it in a report.

Any pointers of how I can proceed?


this can be solved using groovy as the report dataset type (see the docs for more info).

Just do a

// my groovy script that loads the data...

// do some stuff

// get access to params via params['xyz']
println params['xyz']

// call services through AppBeans.get()
MyService myService = AppBeans.get(MyService)
def result = myService.myMethod()

// return a map as the data

return [myData: result]

If you don’t want to change it at runtime and add some software engineering practices like unit tests e.g. you can create report using class defined templates.


Thanks Mario,

this started me in the right direction!